Binary to run on a Raspberry Pi, read regular values from a DHT11 temperature and humidity sensor, and submit values to an MQTT topic.
This assumes you're using a DHT11 temperature and humidity sensor.
Refer to this page for Raspberry Pi pinouts. Make sure you connect the data line to a pin labeled "GPIO" on that page, and pass that pin to the binary.
(Arch Linux x86_64 cross compilation instructions)
Required packages:
arm-linux-gnueabihf-gcc
(AUR) (need to edit PKGBUILD files for-stage1
,-stage2
, and the final package
cross build --target armv7-unknown-linux-gnueabihf --release
Ensure the running user is in the gpio
group, otherwise you'll see errors like this: Error: Permission denied: /dev/gpiomem
. Then,