my code wont work ..... well duhh or els i wouldnt be here XD
so the problem is i want the Delay integer to go up and down from 0 to 180 in steps of 1.
now i thought i could grab some code from the servo library and that would be it but it wasnt " it"....
the Delay integer is suposed to control the delay, thus making the 3 leds blin faster and slower in steps of 1 milisecond .
and after that display it on the serial monitor .
now the only thing it does is display a 9 and blink along on delays of 9 ....
please help me i know it might be a small stupid mistake but im just into this programming thing alltogether so yeah thanks in advance.
this is the code i took inspiration from
void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
and this is the code i made out of it
int Delay = 0;
void setup () {
Serial.begin(9600);
pinMode (12 , OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
}
void loop(){
for(Delay = 0; Delay < 180; Delay += 1)
digitalWrite (12, HIGH);
delay(Delay);
for(Delay = 180; Delay>=1; Delay-=1)
digitalWrite (12, LOW);
delay(Delay);
for(Delay = 0; Delay < 180; Delay += 1)
digitalWrite (11, HIGH);
delay(Delay);
for(Delay = 180; Delay>=1; Delay-=1)
digitalWrite (11, LOW);
delay(Delay);
for(Delay = 0; Delay < 180; Delay += 1)
digitalWrite (10, HIGH);
delay(Delay);
for(Delay = 180; Delay>=10; Delay-=1)
digitalWrite (10, LOW);
delay(Delay);
Serial.println(Delay);
}