I am a beginner in Arduino. I would like to control 64 LEDs using 2 Arduino Mega boards.
The logic is:
- Arduino 1 blinks the LED in serial ===>
- Arduino 1 finished blinking and sends the signal (HIGH) to Arduino 2 ===>
- Arduino 2 blinks the LED in serial ===>
- Arduino 2 finishes blinking and sends a signal (HIGH) to Arduino 1, and both Arduinos reset using
asm volatile("jmp 0")
.
I am using pin 52 as TX and pin 53 as RX for both.
And now the problem is that after Arduino 1 finishes blinking and sends out the signal (HIGH) to Arduino 2, it doesn't wait for the signal from Arduino 2 but resets itself.
Can anyone have a look of my code to see whether it is a logical mistake or a coding error?
digitalWrite(TX, HIGH);
delay(1000);
if(digitalRead(RX)==HIGH) {
asm volatile("jmp 0");
}