Hardware I/O
The Hardware I/O library allows access to the computer's hardware peripherals, such as digital inputs and outputs, serial busses, and the like, in a fashion similar to the Arduino platform. This library is only available for embedded Linux boards with the necessary kernel drivers, such as the Raspberry Pi.
The source code is available on the processing GitHub repository. Please report bugs here.
GPIO
- GPIO
The GPIO class reads and writes from General Purpose I/O pins
- attachInterrupt()
Calls a function when the value of an input pin changes
- digitalRead()
Returns the value of an input pin
- digitalWrite()
Sets an output pin to be either high or low
- interrupts()
Allows interrupts to happen
- noInterrupts()
Prevents interrupts from happpening
- pinMode()
Configures a pin to act either as input or output
- releaseInterrupt()
Stops listening for interrupts on an input pin
- releasePin()
Gives ownership of a pin back to the operating system
- waitFor()
Waits for the value of an input pin to change
I2C
- I2C
Opens an I2C interface as master
- beginTransmission()
Begins a transmission to an attached device
- close()
Closes the I2C device
- endTransmission()
Ends the current transmissions
- list()
Lists all available I2C interfaces
- read()
Read bytes from the attached device
- write()
Add bytes to be written to the device
LED
- LED
Opens a LED device
- brightness()
Sets the brightness
- close()
Restores the previous state
- list()
Lists all available LED devices
PWM
SPI
- SPI
Opens an SPI interface as master
- close()
Closes the SPI interface
- list()
Lists all available SPI interfaces
- settings()
Configures the SPI interface
- transfer()
Transfers data over the SPI bus
Software Servo
- SoftwareServo
Opens an RC servo motor connected to a GPIO pin
- attach()
Attaches a servo motor to a GPIO pin
You must call this function before calling write(). Note that the servo motor will only be instructed to move after the first time write() is called.
The optional parameters minPulse and maxPulse control the minimum and maximum pulse width durations. The default values, identical to those of Arduino's Servo class, should be compatible with most servo motors. - attached()
Returns whether a servo motor is attached to a pin
- detach()
Detatches a servo motor from a GPIO pin
- write()
Moves a servo motor to a given orientation