rpi_set: Turn lines on or off

View source: R/rpi_set.R

rpi_setR Documentation

Turn lines on or off

Description

Turn lines on or off

Usage

rpi_set(pin_number, onOff)

Arguments

pin_number

one or more pin numbers as found on the Raspberry pi GPIO. Use the actual pin numbers (i.e. 1:40)

onOff

a vector the same length of pin_number with values of 0 or 1 to turn the line off or on

Value

no value is returned

Examples


# turns pin 19 on, 21 off, and 23 on.
# This corresponds to gpio09, gpio10, and gpio11
rpi_set(pin_number = c(19, 21, 23), onOff = c(1,0,1))

toggleThesePins <- c(19,21,23)
rpi_set(toggleThesePins, 1) # turns all three pins on. onOff is recycled
Sys.sleep(1)
rpi_set(toggleThesePins, c(0,1,0)) # turns off pins 19 and 23
Sys.sleep(1)
rpi_set(toggleThesePins, 0) # turns off all pins


mnr/rpigpior documentation built on May 3, 2024, 12:14 a.m.