Hi Guys,
I am trying to flash the L.E.D on pin13. The loop count comes from a number I enter in the "Serial Monitor". So, in other words, the pin13 L.E.D must flash the number I enter in the "Serial Monitor" ... Also, it prints the number I enter and the count number to the "Serial Monitor".
However, it seems to flash 51 times and then stop ... ... Somewhere I have made a BIG boo-boo ...
...
Here is the code:
##############################
int ledPin = 13;
int ledCount = 0 ;
void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(9600); // Starts serial data
}
void loop()
{
if (Serial.available() > 0)
{
int inByte = Serial.read(); // waits untill somthing is typed
while ( ledCount != inByte )
{
digitalWrite(ledPin, HIGH);
delay(500) ;
digitalWrite(ledPin, LOW);
delay(500) ;
if ( ledCount == inByte )
{
exit ;
}
else
{
ledCount++ ;
}
Serial.print (inByte) ;
Serial.print (" ") ;
Serial.print ( ledCount ) ;
Serial.println ("") ;
}
}
}
##############################
Hope you can help ...
Danny