12. Networking and communications¶
Code from one project;
void setup() {
// initialize both serial ports:
Serial.begin(115200);
//Serial0.begin(115200);
Serial1.begin(115200, SERIAL_8N1, D7, D6);
}
void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
// int inByte = Serial0.read();
String s =Serial1.readString();
delay(50);
// Serial.write(inByte);
Serial.println(s);
//}
// read from port 0, send to port 1:
// if (Serial.available()) {
// int inByte = Serial.read();
// Serial0.write(inByte);
String t =Serial.readString();
delay(50);
Serial1.println("katoh");
}
}
Code from the other Project;