. Design and build a wired &/or wireless network connecting at least two processors.
This week we have to design and build a wired or wireless network connecting at least two nodes.
It is similar to speaking. We will learn how to talk with other devices like computers, controllers etc.
I'm planning to make a small network based on serial asynchronous bus.
The asynchronous serial interface is so called because the transmitted & received data are not synchronised over any extended period of time and hence no special means of synchronising the clocks at the transmitter and receiver is necessary.
1. Schematic of Bridge board.
2. Design of Bridge board.
3. Schematic of 1st Node board
4. Design of 1st Node board
5. Schematic of 2nd Node board
6. Design of 1st Node board
I milled the boards in modella and stuffed it.
#include
SoftwareSerial mySerial(0,1);
const int buttonPin = 8;
const int ledPin = 7 ;
int buttonState = 0;
int i=0;
int nodes = 2;
void setup() {
mySerial.begin(9600);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(buttonPin,HIGH);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
mySerial.print("node id = ");
mySerial.println(i);
mySerial.write(i);
digitalWrite(ledPin, HIGH);
i++;
delay(200);
if(i > nodes)
i = 0;
}
else {
digitalWrite(ledPin, LOW);
}
}
#define nodeId '1'
#include
SoftwareSerial mySerial(3,4);
const int ledPin = 0 ; // the number of the LED pin
char data;
void setup() {
// initialize
pinMode(ledPin, OUTPUT);
mySerial.begin(9600);
}
void loop() {
data = mySerial.read();
mySerial.println(data);
if (data == nodeId) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
delay(10);
}