How To Make Two ARDUINO Microcontrollers Talk To Each Other

This tutorial will show you how to make two ARDUINO Microcontroller boards serial communicate with each other…

Click on video below for full tutorial..

Check us out on Facebook!

ARDUINO Sketches:

Transmitter:

int val;
#define button 2
void setup() {
Serial.begin(9600);
pinMode(button,INPUT);
}

void loop() {
val = digitalRead(button);
if (val == HIGH)
{
Serial.write(100);
delay(250);
}
}

Receiver:

#define led 2
int val;
int pos = 0;
void setup() {
Serial.begin(9600);
pinMode(led,OUTPUT);

}

void loop() {
if (Serial.available() > 0)
{
val = Serial.read();
if (val == 100 && pos == 0)
{
digitalWrite(led, HIGH);
pos = 1;
}
else if (val == 100 && pos == 1)
{
digitalWrite(led, LOW);
pos = 0;
}

}
}