I'm new here and I do not know if this is the right forum here. But I do have problems with HardwareSerial. So I want to ask: what's wrong with my code?
Here is a stripped down version of my code:
Code: Select all
#include "HardwareSerial.h"
#include "SDS011.h"
HardwareSerial sdsSerial(2);
#define ESP_PIN_TX 12 // 35
#define ESP_PIN_RX 13 // 34
SDS011 sdsSensor;
float pm10, pm25;
void setup()
{
Serial.begin(115200);
pinMode(ESP_PIN_TX, OUTPUT);
pinMode(ESP_PIN_RX, INPUT);
sdsSerial.begin(9600, SERIAL_8N1, ESP_PIN_RX, ESP_PIN_TX);
// in the following line it crashes:
sdsSensor.begin (&sdsSerial);
Serial.println("SDS011 start stop and reporting sample");
}
void loop()
{
Serial.println("set sleep");
........
}
What Is wrong here?rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
HardwareSerial::end()
This is the board I am using: https://de.aliexpress.com/item/32915894264.html
I added an SDS011, a sensor for measuring fine-dust particles.
I'm using this library: https://github.com/ricki-z/SDS011
This software runs on an Arduino Mega 2560 without any problems, after some minor modifications.
Thanks.
PS: I'm coming from the software-side, so I have (practically) no knowledge about the hardware.