You are on page 1of 5

Internet of Things

Serial Communication between 2 Arduino


Serial Communication • Sends data bit by bit at one
clock pulse
• Requires one wire to transmit
the data
• Communication speed is slow
• Preferred for long distance
communication
• Baud rate is the speed of
transferring data from the
transmitter to a receiver in the
form of bits per second.
• Standard baud rates are 1200,
2400, 4800, 9600, 57600.
Serial
Communication
Between 2
Arduino
int pin1 =7;
void setup()
{
Serial.begin(9600); // Begin the Serial at 9600 Baud
pinMode(pin1, OUTPUT);
}
Code void loop() {
if (Serial.available()) // If data in the buffer, a single character is read and copied to the char variable called “data”
{
char data = Serial.read(); //Read the serial data and store in var
Serial.println(data);
if( data == '1’)
{
digitalWrite(pin1, HIGH);
}
delay(1000);
digitalWrite(pin1,LOW); //Print data on Serial Monitor
}
}
Thank You

You might also like