I have 2 boards wired up to a breadboard.
A) Wemos esp8266-12F
B) Arduino pro micro mega32u4
Grounds are connected, Vcc-s are connected and A:RX is connected to B:TX.
A:RX/TX pins are -> Serial as these pins are fed to USB/SERIAL IC
B:RX/TX pins are -> Serial1 as atmega32u4 uses dedicated pins for USB and RX/TX is available on Serial1
Here is my code on A:
void setup() {
Serial.begin(115200);
while (!Serial) {
}
}
byte rx_byte = 0; // stores received byte
void loop() {
Serial.println("hello world!");
delay(100);
}
Here is my code on B:
void setup() {
Serial.begin(115200);
Serial1.begin(115200);
while (!Serial) { }
while (!Serial1) { }
}
byte inByte = 0x0;
byte str[50] = "";
byte *pstr;
void loop() {
if (Serial1.available() > 0) {
*pstr = Serial1.read();
Serial.print((char) *pstr);
Serial.println(pstr - str);
pstr++;
} else {
*pstr = 0;
pstr = str;
}
}