void setup()
{
pinMode(3, OUTPUT);
Serial.begin(9600);
Serial.println("Please type 'ON' to turn the LED ON");
Serial.println("Please type 'OFF' to turn the LED OFF");
Serial.println("Please type 'FLASH' to FLASH the LED");
}
void loop()
{
if (Serial.available() > 0)
{
String input = Serial.readStringUntil('\n');
if (input == "ON")
{
digitalWrite(3, HIGH);
}
else if (input == "FLASH")
{
for(int x = 0 ;x<5 ;x++)
{
digitalWrite(3, HIGH);
delay(500);
digitalWrite(3, LOW);
delay(500);
}
/*
digitalWrite(3, HIGH);
delay(100);
digitalWrite(3, LOW);
delay(100);
digitalWrite(3, HIGH);
delay(100);
digitalWrite(3, LOW);
delay(100);
digitalWrite(3, HIGH);
delay(100);
digitalWrite(3, LOW);
delay(100);
digitalWrite(3, HIGH);
delay(100);
digitalWrite(3, LOW);*/
}
else if(input == "OFF")
{
digitalWrite(3, LOW);
}
else
{
Serial.println("That is not correct,try again");
}
}
}