Following the previous week, I design another arduino board and connect them together with serial port. In combine with two CNY70 optical censors and the circuits they need.
Schematic Design
Board
Board fileAnd I worte a code to do a little testing to send some data from one board to another
Board1(sender)
char str = 0;
void setup() {
Serial.begin(57600);
}
void loop() {
Serial.write(str);
delay(10);
}
Board2(receiver)
void setup() {
Serial.begin(57600);
}
void loop() {
if (Serial.available()) {
Serial.println('a');
Serial.println('b');
}
}
So when the two board connect through serial, one will send data and the receiver will print "a" and "b". And here is the result
I am not quite sure why the baud rate has to be at 57600, but in other case, The data print out sometimes become a mess, and 57600 happens to be the most stable choice.
