Arduino single wire binary communication


Here’s basic example of how you can use one wire to easily communicate between two arduinos.

Slave Arduino

int val;
void setup(){
pinMode(1, INPUT); //pin 1 is the single wire connection
pinMode(7,OUTPUT); //pin 7 is connected to an LED
}
void loop(){
val = digitalRead(1);
digitalWrite(7, val);
}

So basically how this works is this slave code will read any input coming from pin 1 and translate that to an output on pin 7. This can be used to make two arduinos blink LEDs in sync or do other cool stuff over wire.

Here’s a vid of this idea operating with a randomly blinking LED.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s