Reading a Sensor

I’m trying to port an Arduino library to the Wixel. I noticed in the library that it is reading incoming bits from a device (DHT22). It does this within a loop that is bounded by cli() and sei() calls, which I assume clear, and then re-enable interrupt processing. Is that going to work on a Wixel? Is that going to interfere with the radio? What would be the “Wixel” way to read incoming bits from an external sensor?



Hello, Bruce.

The functions cli() and set() will not work on a Wixel, but the equivalents would be “EA = 0;” and “EA = 1;” if I recall correctly. The important thing to figure out is how long the library will disable interrupts for. If it disables them for many milliseconds, then it would probably make the radio communication less efficient, because the radio_link library would be unable to send acknowledgment packets in a timely manner. The radio would still work though, and the effect of the problem would depend on how often you read the sensor.

I found the DHT22 at I think a nice way to read this sensor might be to use pin-change interrupts and a timer, similar to the Arduino’s SoftwareSerial library. However, that would probably be a lot of work to implement and I would not do it unless you are sure the simpler way doesn’t work for you.


Hi David,

Thanks for the advice. It looks like the interrupt would be disabled for a maximum of ~22 milliseconds. Seems like a lot. Never the less, I’ll try the “easy” method first and see if I can get it to work. Failing to ack a couple of packets shouldn’t be a big problem, because data will only be sent once every couple of seconds.