Communication Between Arduino UNO © GPL3+

If you want use two Arduino, you can use a simple I/O port to communicate. The point of question is the Ground.

  • 997 views
  • 1 comment
  • 4 respects

Components and supplies

Apps and online services

About this project

If you want use two Arduino, you can use a simple I/O port to communicate.

The point of question is the Ground. When you connect two Arduino with each other, you have to connect their ground. In this tutorial when the Arduino UNO number 1 lights ON the onboard LED, the Arduino UNO number 2 connects to the computer, prints HIGH on the serial port and switches ON the onboard LED.

The result is two Arduino UNO that blink together.

Step 1: The connections of Arduino UNO to Arduino UNO

See the image and connect two Arduino.

Step 2: Now the code

Now download two files. Upload the sketch Output on Arduino UNO number 1 and Input sketch on Arduino UNO number 2. Now connect the Arduino UNO number 2 to the computer and open the Serial port to 9600 baud.

You can see the LED on board of Arduino UNO number 1 blinking, and at same time you can see the LED on board of Arduino UNO number 2. If you disconnect pin number 6 of the Arduino UNO number 1 from the breadboard, you can see the blinking only on the Arduino UNO number 1.

Code

Arduino UNO AArduino
#define LED 13
#define IN A0
int val = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(IN, INPUT);
  pinMode(LED, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  val = analogRead(IN);
  Serial.println(val);
  if (val >= 740) {
    digitalWrite(LED, HIGH);
    Serial.println("HIGH");
  }
  else {
    digitalWrite(LED, LOW);
  }
  //delay(50);
}
Arduino UNO BArduino
#define SMS 6
#define LED 13

void setup() {
pinMode(SMS, OUTPUT);
pinMode (LED, OUTPUT);
}

void loop() {
digitalWrite(SMS, HIGH);
digitalWrite(LED,HIGH);
delay(2000);
digitalWrite(SMS, LOW);
digitalWrite(LED, LOW);
delay(200);
}

Comments

Similar projects you might like

Development Board for AtTiny MCU

by Vincenzo G.

  • 183 views
  • 0 comments
  • 5 respects

The Magnetic Field and RGB Tester

Project tutorial by Kutluhan Aktar

  • 410 views
  • 0 comments
  • 5 respects

Version 2.0 Advanced Attendance System (Without Ethernet)

Project tutorial by GadgetProgrammers

  • 3,158 views
  • 5 comments
  • 44 respects

How To Use DS18B20 Water Proof Temperature Sensor

Project showcase by IoTBoys

  • 257 views
  • 0 comments
  • 4 respects

Control LED Using Your Voice Command

by IoTBoys

  • 1,190 views
  • 1 comment
  • 12 respects
Add projectSign up / Login