I am trying my first application of the Moreino, which involves also using the DHT11 temperature/humidity sensor. Getting it to work with an ordinary Arduino is stone-simple, but when I hook one up to a Moteino (the 328 version), I get either no response from it, or nonsense answers.
The DHT11 has its own single-wire interface protocol, so I don't know what it is doing when communicating. But here's the details of what is going on around it. I am using hardware interrupt 1 (pin D3), and I am using a pin-change interrupt on pin 5. Additionally, I set up timer2 as a 2 KHz. clock to measure time intervals in the program. I am not using the delay() function anywhere, because it tends to cause mysterious problems in time-critical programs.
Now, if I permit interrupts to be enabled while reading the DHT11, I get all zeros back, meaning no data was returned. If I disable interrupts while reading the DHT11, I get numbers back for temperature and humidty, but they are bogus.
This DHT11 has been tested using just a good old-fashioned Arduino Uno, and the simplest test code to read it. In those circumstances, it works fine.
And finally, my use of pins on the Moteino has avoided any of the pins listed as needed for the transceiver of flash memory.
Thanks in advance for any insights on this.
I don't remember the specifics, but it is true that if you're using the DHTxx communication protocol, you must disable interrupts during critical portions of the protocol because the device won't tolerate any timing variations to the signalling. However, this should already be taken care of in the library.
There should also be some protection to make sure that you don't read the device any faster than once every 2 seconds.
Tom
This is now a solved problem. Elsewhere on this forum was a post concerning a DHT library named DHT-tws, which provides compatibility with the Moteino. Thanks, Tom