is there anything wrong with this code? The arduino code editior says it is ok, but it doesnt work.
int d1a=13;
int d2a= 12;
int s1= 10;
int d1b=11;
int d2b=8;
int sb=9;
int sensorPin = 5;
void setup () {
Serial.begin(9600);
pinMode (d1a, OUTPUT);
pinMode (d2a, OUTPUT);
pinMode (s1, OUTPUT);
pinMode (d1b, OUTPUT);
pinMode (d2b, OUTPUT);
pinMode (sb, OUTPUT);
}
void loop () {
int val= analogRead (sensorPin);
Serial.println (val);
if (val > 520) {
analogWrite (10, 0);
digitalWrite (13 , LOW);
digitalWrite (12, HIGH);
analogWrite (9, 255);
digitalWrite (11 , LOW);
digitalWrite (8, HIGH);
}
else {
analogWrite (10, 255);
digitalWrite (13 ,LOW);
digitalWrite (12, HIGH);
analogWrite (9, 255);
digitalWrite (11 , LOW);
digitalWrite (8, HIGH);
}
}