So i made this code by copying some of the codes from examples and arduino tutorials and a little by my c++ knowledge
int incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
\
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();}
if (incomingByte=108 and 117 and 109 and 105 and 110 and 97);{
// say what you got:
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
Serial.print("Led aprins!");}
else
Serial.print("PAROLA GRESITA");
}
}
I get the error
else without a previous if
even if i have a previous if
if (incomingByte=108 and 117 and 109 and 105 and 110 and 97);{
// say what you got:
= Is for assignments.
== Is for comparison.
You shouldn't be using "and" without another comparison, and you shouldn't have a semicolon at the end of the if.
if (incomingByte=108 and 117 and 109 and 105 and 110 and 97);{
// say what you got:
= Is for assignments.
== Is for comparison.
You shouldn't be using "and" without another comparison, and you shouldn't have a semicolon at the end of the if.
in my project i want to write the word "lumina" and the on bord led to light up and if i type something else that lumina i will get the message parola gresita how i can do that without useing ''and''
if (incomingByte==108 and 117 and 109 and 105 and 110 and 97);