Physical Computing Week 09
Creating a communication system between two Arduinos
Nov 5 · Unlisted
The two Arduinos boards are connected via the RX and TX pins (first Arduino’s TX pin to another’s RX pin and vice versa), ground is connected to ground and 5V to 5V.

Code for the Sender Arduino:
void setup() {
Serial.begin(9600);
}void loop() {
Serial.println("A"),
delay(1000);
Serial.println("B"),
delay(1000);
}
Code for the Receiver Arduino:
int data;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);}void loop() {
if (Serial.available()){
data = Serial.read();
if (data=='A'){
digitalWrite(13,HIGH);
} else if (data=='B') {
digitalWrite(13,LOW);
}
}
}
