ricki-z / SDS011

Arduino library for SDS011 dust sensor
GNU General Public License v3.0
81 stars 53 forks source link

ESP32 compatibility #12

Closed sleiner closed 5 years ago

sleiner commented 6 years ago

This makes the library out-of-the-box compatible to the ESP32 Arduino Core.

Tested with an ESP32 Heltec board: https://www.amazon.com/dp/B076KJZ5QM?ref=yo_pop_ma_swf

tmhwk commented 6 years ago

Hi, I've tested it with http://www.heltec.cn/download/WIFI_LoRa_32_Diagram.pdf and it's working. But I have conflict with OLED. HardwareSerial working only for me with Serial 2: RX pin:16, TX pin:17 pins but OLED integrated with Wifi Lora 32 using pin 16, which have to be in high state all the time to make OLED working. Defining custom pins manually like sdsSerial.begin(9600,SERIAL_8N1, 23, 17); seems not work for me. Do you have any idea how can I fix it?

ricki-z commented 6 years ago

@sleiner I have updated the library to my actual version. This version supports hardware serial. So your changes shouldn't be needed. Now you can give an existing software or hardware serial object as a parameter to the begin() function. Could you please test this version with your ESP32. If its working I will change the library.properties file.

melzai commented 5 years ago

@ricki-z sorry, your code doesn't work. You need to additionally remove the software serial parts like @sleiner did.

misan commented 5 years ago

@sleiner Use of 'error' variable on HardwareSerial example makes Windows version of Arduino IDE to error out. (I just noticed your pull request after I did mine :-)