Raspberry Pi (raspberrypi) Component
Available as of Camel 2.16+ on Camel-extra-repository (in progress, see code source paragraph below)
The rbpi: component provides Raspberry Pi based endpoints for consuming GPIO Event. It can generates GPIO output event
The component uses the pi4j library.
Maven users will need to add the following dependency to their pom.xml
for this component:
The URI format to configure and manage PIN
Raspberry Option
Name | Type | Required | Enum Values | Description |
---|
id | java.lang.String | true | | To configure the pin id (Pi4j index) |
state | com.pi4j.io.gpio.PinState | | LOW HIGH | To configure pin state : if DIGITAL_INPUT then it is the event trigger state if DIGITAL_OUTPUT then started state |
mode | com.pi4j.io.gpio.PinMode | true | DIGITAL_OUTPUT DIGITAL_INPUT PWM_OUTPUT ANALOG_OUTPUT ANALOG_INPUT | To configure GPIO pin mode Check Pi4j library for more details |
action | org.apache.camel.component.raspberrypi.PinAction | | TOGGLE BUZZ HIGH LOW HEADER | Default : use Body to if Action for ouput Pin (TOGGLE, BUZZ, HIGH, LOW for digital only) (HEADER digital and analog TODO) |
value | double | | 0 | To configure the started value |
shutdownExport | boolean | | true | To configure the pin shutdown behavior |
shutdownState | com.pi4j.io.gpio.PinState | | LOW HIGH | To configure the pin state value before exit |
shutdownResistance | com.pi4j.io.gpio.PinPullResistance | | OFF PULL_DOWN PULL_UP | To configure the pin resistance before exit |
pullResistance | com.pi4j.io.gpio.PinPullResistance | | OFF PULL_DOWN PULL_UP | To configure the input pull resistance, Avoid strange value for info http://en.wikipedia.org/wiki/Pull-up_resistor |
type | org.apache.camel.component.raspberrypi.RaspberryType | true | pin i2c spi serial | pin : GPIO pi4j and wiringpi mapping, i2c, spi, serial not yet available |
Example :
Plug an button on GPIO 1, and LED on GPIO 2 (with Resistor) and code a route like this
Source Code
Camel-raspberrypi component uses pi4j and wiringpi. These librairies are LGPL licensed and cannot be include to the official camel repository.
Code source is available at camel-iot-labs repository