/* the pin 13 led is set to low because even if no set up is made for it, it will still light. So to make it go out I have to put it in the program and set it to LOW.
The other const int’s , ints,PinModes, are there because this is only part of a larger program that works just fine except anything doing with a loop. I modified my program and removed the semicolon from behind the for statement but that did not work.
The loop will not exit the LEDS’s continue to blink.
*/
Const int buttonPin1=2;
Const int buttonPin2=2;
Const int buttonPin3=2;
Const int buttonPin4=2;
Const int MototPIN1=8;
Const int MototPIN2=9;
Const int MototPIN3=10;
Const int MototPIN4=11;
Const int led=13;
Int buttonState1=0;
Int buttonState2=0;
Int buttonState3=0;
Int buttonState4=0;
Int X=0;
Void setup ( ) {
pinMode(MotorPin1,output);
pinMode(MotorPin2,output);
pinMode(MotorPin3,output);
pinMode(MotorPin4,output);
pinMode(buttonPin1,input);
pinMode(buttonPin2,input);
pinMode(buttonPin1,input);
pinMode(buttonPin1,input); }
void loop ()
{
Digitalwrite (led,LOW);
buttonState1=Digitalread(buttonPin1);
buttonState2=Digitalread(buttonPin2);
buttonState3=Digitalread(buttonPin3);
buttonState4=Digitalread(buttonPin4);
for (X=0;X<5:X++)
{digitalwrite (MototPin1,High); // I expect the led’s to blink 5 times and exit the loop but the continue to blink forever
digitalwrite (MototPin2,High);
delay (1000);
digitalwrite (MototPin3,LOW);
digitalwrite (MototPin4,LOW);
delay (1000);
}}
Reply, Reply All or Forward | More