How to read Serial1 or Serial2 in firebeetle v4.0
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
I'm trying to read a sensor with UART protocol, with other boards like nodeMCU I can read without problems with this code:
How can I read from serial1 with firebeetle board? Thanks in advance.
Code: Select all
But if I try to upload this code to the firebeetle board I get the next error:#include "cozir.h"
COZIR czr(&Serial1);
void setup()
{
Serial1.begin(9600);
czr.init();
Serial.begin(115200);
Serial.print("Cozir HardwareSerial: ");
Serial.println(COZIR_LIB_VERSION);
Serial.println();
delay(1000);
}
void loop()
{
float t = czr.Celsius();
float f = czr.Fahrenheit();
float h = czr.Humidity();
uint32_t c = czr.CO2();
Serial.print("Celcius =\t"); Serial.println(t);
Serial.print("Fahrenheit =\t"); Serial.println(f);
Serial.print("Humidity =\t"); Serial.println(h);
Serial.print("CO2 =\t"); Serial.println(c);
Serial.println();
delay(3000);
}
CozirDemoHWSerial:15:12: error: 'Serial1' was not declared in this scope
COZIR czr(&Serial1);
^
C:\Users\alvar\Documents\Arduino\libraries\Cozir-master\examples\CozirDemoHWSerial\CozirDemoHWSerial.ino: In function 'void setup()':
CozirDemoHWSerial:19:3: error: 'Serial1' was not declared in this scope
Serial1.begin(9600);
^
exit status 1
'Serial1' was not declared in this scope
How can I read from serial1 with firebeetle board? Thanks in advance.