Raspberry Pi Model 4
Linux / Python
~ $45 USD (depending on model)
consumes ~3-6 watts
USB, HDMI, Ethernet, GPIO, camera port, display port, audio
Configuring geany for R
Saved as “hello_world.R”
opens terminal. Plot is created as PDF next to program
Geany terminal can be used to run R
enter Geany terminal, then type R to start R
sudo to install packages
Other libraries:
One of many libraries for GPIO access
sudo apt-get install libgpiod-dev gpiod
Saved as “hello_gpio.R”
Saved as “hello_gpio_control.R”
# assign buttons (use BCM - not board)
getGPIOcmd <- "gpioget gpiochip0 21"
# assign control pin (use BCM)
setGPIOcmd_on <- "gpioset gpiochip0 9=1"
setGPIOcmd_off <- "gpioset gpiochip0 9=0"
while (TRUE) {
if (system(getGPIOcmd, intern=TRUE) == 1) print ("Try Me!")
system(setGPIOcmd_on)
Sys.sleep(1)
system(setGPIOcmd_off)
Sys.sleep(3)
}Problem: Drivers for circuits are written in other languages.
Solution: R works with other languages
rcpp for C
reticulate for python