Serial communication allows two Arduino boards to exchange data over a single wire by transmitting bits one at a time synchronized to a clock signal. The code example shows how one Arduino (set as transmitter) can send data over serial to a second Arduino (set as receiver), which then uses the received data to control an output pin and turn an LED on or off. When the transmitting Arduino sends the character '1', the receiving Arduino will set the pin high for one second then low.
Serial communication allows two Arduino boards to exchange data over a single wire by transmitting bits one at a time synchronized to a clock signal. The code example shows how one Arduino (set as transmitter) can send data over serial to a second Arduino (set as receiver), which then uses the received data to control an output pin and turn an LED on or off. When the transmitting Arduino sends the character '1', the receiving Arduino will set the pin high for one second then low.
Serial communication allows two Arduino boards to exchange data over a single wire by transmitting bits one at a time synchronized to a clock signal. The code example shows how one Arduino (set as transmitter) can send data over serial to a second Arduino (set as receiver), which then uses the received data to control an output pin and turn an LED on or off. When the transmitting Arduino sends the character '1', the receiving Arduino will set the pin high for one second then low.
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