jaebarn
Hello,
 
I'm having a bit of trouble trying to interface a DHT11 sensor. I'm using a Arduino_ext to try and pull data out of the DHT11 and then I'm wanting to write the values to a variable that I can then use in the main OpenPLC program. I'm starting off basic by modifying some existing Arduino code that uses the DHT_sensor_library. It compiles fine but faults when I try to download to the ESP32.
 
Can anyone advise where I am going wrong? I've attached a snip of my code and a snip of the error log. Temp and Humidity values were "floats" in original code but I can't see floats in the OpenPLC variable data types so have set the variables as REAL's instead.
Reply 0 0
thiagoralves
You can’t use setup() and loop() functions on an Arduino extension. You need to use the functions created in the template when you create the Arduino extension instead.
Reply 0 0
jaebarn
Ahh, so that's why! I cut and pasted the sample code and didn't notice the difference. I've amended it to void sketch_setup() and void sketch_loop() and now it's compiling and downloading correctly. Thank you very much. That had me super confused.
Reply 1 0
Reply