Week 13: Networking & Communication


For this assignment I thought I'd talk to each other two board built by me. The signal that must communicate with each other is a flashing LED every one second.
I started charging two sketch, the first will be inserted into the sender and the second in Fabduino receiver.



Here is the code receiver:

const int IntegratedLed = 13; //I use the onboard led on pin sck(13)

char input; //this is the message I send

void setup() {
pinMode(IntegratedLed, OUTPUT); //the IntegratedLed is an OUTPUT
Serial.begin(9600); //setting the baudrate
}

//START
void loop() {
input = Serial.read(); //Read from rx source and write on the variable

if (input == '1') {
digitalWrite(IntegratedLed, HIGH); // If read 1, turn on the led

Serial.println("on"); // and print a message
}else{
digitalWrite(IntegratedLed, LOW); // else turn it off

Serial.println("off"); // and print the message
}

delay(1000); // wait a sencond and do it again
}

I used the pin 13 as a communicator and I reversed the cables RX and TX in the two Arduino. To avoid welding directly on the pin cable VCC I powered through the use of my original Arduino Uno which in this case served to give power to my Arduino board.

This is the code of Arduino sender:


void setup() {
Serial.begin(9600);
////My arduino master has a different clock and to work well with the slave need this baudrate
}

void loop() {
Serial.println('1'); // print the char 1
delay(1000); // wait a second
Serial.println('0'); // print 0
delay(1000); // wait a second again
}

File

This is the video of communication to my boards brothers :)