I am wondering if this is correct? I am trying to use different parts of code with respect to what I send via the receive port.
So if I send a char 't' via the serial port, the "else if" should execute constantly until I send a diffrent char. If I write the serial data to data_in variable, will it initialize to the value I have sent over the serial (and stay the same in all subsequent iterations until I change the value)?
I am having some problems with this code, since the value I send via the serial event doesn't change (the data_in part).
Aside for the incorrect name, why are you reading the data in a while loop? If you have the Serial Monitor set to append anything to the data sent, the data will arrive relatively close together, and all that data_in will end up containing is the last character.