Hi there. I am trying to write a code which checks if there is any serial input. If there is serial input it reads it and stores it in a variable. The variable is then checked to a known value using an if statement. If they are the same it should display on the serial monitor. I checked around and can't figure out how to store the "thisWillNotWork" variable. What do I need to do to store that variable.
[code]
#include "Nextion.h"
//This is the code that is sent from the touch screen display
thisWillNotWork = 65 00 02 01 FF FF FF;
void setup()
{
/* Set the baudrate which is for debug and communicate with Nextion screen. */
nexInit();
}
void loop(void)
{
//Checks to see if any text was sent from the display
if (Serial.available() > 0) {
//reads and stores the information
byte incomingByte = Serial.read();
}
//if the information is the same as the known value it displays the serial print
if ( incomingByte = thisWillNotWork) {
Serial.print("The plus sign was pressed");
}
}
[/code]