Hi,
I am super new to Arduino. Board is awesome! Please see my question below.
Arduino 2560
Goal: Send COMMANDS from Win APP to Arduino Board. Board activate Voltage Pins Based on the Commands.
Issue: For some reason "If" statement is NOT working.
I can talk to the board thru my serial communication I send letter "A" over serial. And get Response letter "A" back.
Now when I put "If" statement. If serial reads "A" to do something its doesn't work.
I think statement that I use is NOT correct for this board or I am missing something very simple. Typically in C if( s == t ){} to compare
Code below:
String acti;
void setup() {
// initialize serial:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB
}
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() { }
void serialEvent() {
acti= Serial.readString();
if ((acti)=="z"){
Serial.print(acti);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
} //Serial.print(acti); If this is active boards does receive the command
}
If you remove "If" statement everything works.
Please advise if more information is needed.
Thanks