This Week's assignment was to do networking and communication.So because I ddin't know much about networking I tried the simplest form of communication which is serial communication among others like(SPI communication,UART...)And I designed a simple LED board that I printed twice,both of them have two pin headers that would facilitate me in serial communication of both
I first verified that each circuit was working so I downloaded codes to each board to see if it works and I could easily upload codes to each but when I tried connecting both of them it became a challenge that I couldn't resolve.
The Codes Used
#include < SoftwareSerial.h>
int v;
SoftwareSerial mySerial(0,1); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
pinMode(8,OUTPUT);
}
void loop() { // run over and over
mySerial.print("1");
digitalWrite(8, HIGH);
delay(500);
mySerial.print("2");
digitalWrite(8, LOW);
delay(500);
}
The code for the RX board:
#include < SoftwareSerial.h>
SoftwareSerial mySerial(10,9); //RX, TX
int v;
void setup() {
// initialize digital pin 13 as an output.
mySerial.begin(9600);
pinMode(1, OUTPUT);
pinMode(4,OUTPUT);
// pinMode(7,INPUT_PULLUP);
}
// the loop function runs over and over again forever
void loop() {
v = mySerial.read();
if(v == '1')
{
digitalWrite(1,LOW);
Athough I uploaded I was uploading it I had a big problem when I was uploading it,it ddn't work the only thing I was doing and it would seem to work was when I was commenting the line "mySerial.begin(9600); " but I couldn't have transferred the data witout that command.
>