Page 1 of 1

Heltec wifi kit32, hardware serial

Posted: Wed Jan 30, 2019 7:12 am
by NewPrasertKitt
dear sir, I tried to use UART#2 and relocate RX to pin 5 and TX to pin17. anyway the compiler shows error below.
Don't know what is wrong or what to include to code please help. thanks in advance.
board: heltec wifi kit32 (esp32 with OLED
)
best regards
Newprasertkitt

HardwareSerial mySerial2(2);
mySerial2.begin(9600,SERIAL_8N1,5,7);




sketch_Jan28_ESP32_fingerprintSS_01:10: error: 'mySerial2' does not name a type
mySerial2.begin(9600,SERIAL_8N1,5,7);

^
exit status 1
'mySerial2' does not name a type

Re: Heltec wifi kit32, hardware serial

Posted: Wed Jan 30, 2019 6:53 pm
by Edje11
This works fine for me:

Code: Select all

HardwareSerial Pzemserial(2);
#define RXD2 16 //Gpio pins Serial2
#define TXD2 17
Pzemserial.begin(9600, SERIAL_8N1, RXD2, TXD2);

Re: Heltec wifi kit32, hardware serial

Posted: Thu Jan 31, 2019 2:48 am
by NewPrasertKitt
Hi edje11:thank you for your help,but this Pzem still got error.
mine, version arduino is 1.8.5, what is yours

best regards
newprasertkitt

exit status 1
'Pzemserial' does not name a type

Re: Heltec wifi kit32, hardware serial

Posted: Fri Feb 01, 2019 11:44 pm
by pipi61

Re: Heltec wifi kit32, hardware serial

Posted: Sun Feb 03, 2019 1:47 pm
by NewPrasertKitt
Hi all, I got it.
just need to put the line in Setup function!.


setup {

mySerial2.begin(9600,SERIAL_8N1,5,7);

}


best regards
NewPrasertKitt