Camel Pi4j component
Camel Pi4j component can be used to manage GPIO and I2C bus features from Raspberry Pi. This component uses pi4j library
Maven dependency
Maven users should add the following dependency to their POM file:
io.rhiotcamel-pi4j${rhiot.version}
Avaliable for rhiot.version >= 0.1.1
URI format for GPIO
gpioId must match [A-Z_0-9]+ pattern. By default, pi4j-gpio uses RaspiPin Class, change it via gpioClass property You can use static field name "GPIO_XX", pin name "GPIO [0-9]" or pin address "[0-9]"
Optional URI Parameters
Parameter | Default value | Description |
| ||
| Digital Only: if input mode then state trigger event, if output then started value | |
|
| To configure GPIO pin mode, Check Pi4j library for more details |
| Default : use Body if Action for output Pin (TOGGLE, BUZZ, HIGH, LOW for digital only) (HEADER digital and analog) | |
|
| Analog or PWN Only |
|
| To configure the pin shutdown export |
|
| To configure the pin resistance before exit program |
|
| To configure the pin state value before exit program |
|
| To configure the input pull resistance, Avoid strange value for info http://en.wikipedia.org/wiki/Pull-up_resistor |
|
|
|
|
|
|
Consuming:
Producing
When using producer you can also set or override action using message header with a key of Pi4jConstants.CAMEL_RBPI_PIN_ACTION
Simple button w/ LED mode
Plug an button on GPIO 1, and LED on GPIO 2 (with Resistor) and code a route like this
URI format for I2C
Optional URI Parameters
Parameter | Default value | Description |
| i2c bus | |
| i2c device | |
|
| address to read |
| READ, READ_ADDR, READ_BUFFER, READ_ADDR_BUFFER | |
|
| |
|
| |
|
| |
| cf available i2c driver |
I2C component is really simplistic, the consumer endpoint reads a single byte, or to a buffer of bytes directly from the device. The producer writes 1 or more bytes.
For smarter devices, you must implement a driver.
i2c driver
Driver | Feature |
bmp180 | Temperature and Pressure sensor (http://www.adafruit.com/products/1603) |
tsl2561 | Light sensor (http://www.adafruit.com/products/439) |
lsm303-accel | Accelerometer sensor (http://www.adafruit.com/products/1120) |
lsm303-magne | Magnetometer sensor (http://www.adafruit.com/products/1120) |
mcp23017-lcd | LCD 2x16 char (http://www.adafruit.com/products/1109) |
hts221 | Humidity and Temperature sensor used by the Official RaspberryPi Sense-Hat ST device doc |
lps25h | Pressure and Temperature sensor used by the Official RaspberryPi Sense-Hat ST device doc |
Last updated