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.

  • 1,744 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

Smart Energy Saver for Your Home

Project tutorial by Dhairya Parikh

  • 849 views
  • 8 comments
  • 9 respects

Simple Water Quality Analysis

Project showcase by Wen-Liang Lin

  • 5,603 views
  • 5 comments
  • 8 respects

Secure Your Logins with Biometrics

Project tutorial by Amal Mathew

  • 689 views
  • 0 comments
  • 5 respects

Chicken Coop Automation

Project in progress by BMic

  • 5,033 views
  • 9 comments
  • 15 respects

First Project - Arduino+Blynk

Project tutorial by Vijay Shreenivos

  • 294 views
  • 1 comment
  • 3 respects

Little Rover

Project tutorial by Jeremie

  • 462 views
  • 0 comments
  • 6 respects
Add projectSign up / Login