Parallax Propellor C Drive for Am2303 / DHT22
tomcrawford
Posts: 1,126
Attached is a C driver/demo for the Am2303/DHT22 humidity/temperature. I did it using simple IDE; it requires only the simpletools.h library.
The Am2303 returns 2 bytes of humidity times 10, 2 bytes of degrees celsius times 10 (signed magnitude, not 2's complement, and one byte of checksum.
The function does not use another cog so the main program waits for the 3-4 msec needed to get the data.
The function is not bullet-proof; a dead or misbehaving Am2303 will hang it.
I tried to upload the .side file as well but the filetype is not allowed.
The Am2303 returns 2 bytes of humidity times 10, 2 bytes of degrees celsius times 10 (signed magnitude, not 2's complement, and one byte of checksum.
The function does not use another cog so the main program waits for the 3-4 msec needed to get the data.
The function is not bullet-proof; a dead or misbehaving Am2303 will hang it.
I tried to upload the .side file as well but the filetype is not allowed.
c
4K
Comments
Or you could rename the .side file to a .txt file and upload it like that.