0
I’m making a communication, serial in tinkercad simulator, between two Inuit, my code is displayed, error:
Else without a previuos if
The idea of the program is to press button, in the emitter Arduino is to light led in the emitter and second led , in the other Arduino, receiver by serial communication..
Arduino emissor
void setup() {
Serial.begin(9600);
pinMode(11,INPUT);
pinMode(10,OUTPUT);
}
void loop() {
if(digitalRead(11)){
digitalWrite(10,1);
Serial.println(255);
}
else{
digitalWrite(10,0);
Serial.println(0);
}
delay(100);
}
Arduino receiver
void setup() {
Serial.begin(9600);
pinMode(8,INPUT);
pinMode(10,OUTPUT);
int value;
}
void loop() {
while (Serial.available() > 0) {
int value = Serial.parseInt();
Serial.println(value);
if ( value == 255);{
digitalWrite(10,1);
}else {
digitalWrite(10,0);
}
}
}
The error is in your code
if ( value == 255);{
see the;
in an incorrect location.– Celso Marigo Jr
vlw! Celso was this msm, breaking his head with beast thing! thank you
– Duilio Matias Gonçalves