knitr::opts_chunk$set(echo = TRUE)
Control your Raspberry Pi's DHT11 sensor from R.
Acknowledgments: This package imports the DHT11 Python library.
r2dht11
is currently only available as a GitHub package.
To install it run the following from an R console:
if (!require("remotes")) { install.packages("remotes") } remotes::install_github("jcrodriguez1989/r2dht11", dependencies = TRUE)
Please make sure that your DHT11 is correctly connected to your Raspberry Pi. Take note to which GPIO pin is your DHT11 connected.
In this example, the DHT11 is connected to the GPIO14 pin:
# Load the library. library("r2dht11") # Get a DHT11 sensor instance, which is connected to the GPIO 14 pin. dht11 <- get_dht11_sensor(14) # Read the sensor's values. read_sensor(dht11)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.