Hi Gurus
I am relatively new to Arduino and ESP32, trying to work on a software serial connection from ESP32 dev board to another device. while trying the sample code from espsoftwareserial. I got the following compilation error, need some guidance, maybe doing something really dumb here
environment:
Mac OS X 10.14
Arduino App 1.8.9
ESPSoftwareSerial 5.2.9 installed via Library
I am able to compile and run some other simple program via Arduino to my dev board.
here is the error message for some codes from the ESPSoftwareSerial sample code
In file included from /Users/justin/Documents/Arduino/BasicSerialToBG95/BasicSerialToBG95.ino:1:0:
/Users/justin/Documents/Arduino/libraries/EspSoftwareSerial/src/SoftwareSerial.h:72:9: error: 'size_t SoftwareSerial::readBytes(uint8_t*, size_t)' marked 'override', but does not override
size_t readBytes(uint8_t* buffer, size_t size) override;
^
/Users/justin/Documents/Arduino/libraries/EspSoftwareSerial/src/SoftwareSerial.h:73:9: error: 'size_t SoftwareSerial::readBytes(char*, size_t)' marked 'override', but does not override
size_t readBytes(char* buffer, size_t size) override {
^
exit status 1
Error compiling for board ESP32 Dev Module.
below are the full source code
#include <SoftwareSerial.h>
SoftwareSerial swSer1;
//blink gree LED
uint8_t LED_BUILTIN_GREEN = 18;
uint8_t LED_BUILTIN_RED = 26;
//power on Quectel
uint8_t BG95_POWERON = 13;
uint8_t BG95_RESET = 15;
void setup()
{
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN_GREEN, OUTPUT);
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN_RED, OUTPUT);
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for Native USB only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
swSer1.begin(115200, 19, 27, SWSERIAL_8N1, false, 256);
}
void loop() // run over and over
{
Serial.println("*********Loop with Blinking ****");
digitalWrite(LED_BUILTIN_GREEN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN_GREEN, LOW); // turn the LED off by making the voltage LOW
delay(1000);
Serial.println("\n\nTesting on swSer1");
Serial.print("Enter something to send using swSer1.");
checkSwSerial(&swSer1);
}
void checkSwSerial(SoftwareSerial* ss) {
byte ch;
while (!Serial.available());
ss->enableTx(true);
while (Serial.available()) {
ch = Serial.read();
ss->write(ch);
}
ss->enableTx(false);
// wait 1 second for the reply from SOftwareSerial if any
delay(1000);
if (ss->available()) {
Serial.print("\nResult:");
while (ss->available()) {
ch = (byte)ss->read();
Serial.print(ch < 0x01 ? " 0" : " ");
Serial.print(ch, HEX);
}
Serial.println();
}
}