So,I have a task at hand and that is to use a word, like my name "DASH" as input to Serial Monitor in Arduino so that the LED in the ESP32-WROOM-32 blinks and otherwise, it won't. I am fairly new to the Arduino side and would really appreciate any guidance at all, even though it may be very little info so feel free please.
I am using ESP32-WROOM-32 module and no outside LED, the one that blinks blue in the module itself.
Here's what I have tried:
String incomingString;
int LED_BUILTIN=2;
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
if (Serial.available()>0)
{
String incomingString=Serial.readString();
Serial.println("Enter 'Dhaval' to blink thy LED in hue of blue!");
if (incomingString=="Dhaval"){
Serial.println("You have entered 'Dhaval', needless to say enjoy the beautiful baby blue LED.");
digitalWrite(LED_BUILTIN, HIGH);
}
else
{
Serial.println("Seems that you've entered anything else but Dhaval, please just enter 'Dhaval'.");
}
}
}
I am aware that in this code it would be best to use for loop and if conditions to make it take each character once at a time, but not sure how to achieve that, plus I have a feeling that it may just work with this string defined as when I get to read the entry as to what I have entered and get to print it with Serial.print command it shows exactly the same string.
What I have also thought about is using the above loops as mentioned giving them input parameters as ASCII values by each turn and confirm it and then let the final output say the whole word DASH and that only when verified lets the LED blink.
Thank you in advance.