Are you in a Bind?
The poor documentation can make things seem more complicated than they really are.
Getting an Raspberry Pi output pin working on OpenHAB is actually much easier than you are led to believe.
Here's a quick example on how to get an LED and current limiting resistor connected to Pin 11 (GPIO17) up and going.
All one needs to do is to;
1. Ensure that the GPIO is not exported and used by another process.
2. Connect the LED and resistor.
3. Copy the gpio binding and io files to the openhab addons directory.
4. Create an switch item in the items file to represent the LED
5. Insert the new item into a sitemap file where you want to control it.
6. Test it
The LED anode is connected to Pin11, the LED cathode is connected to the resistor, the other end of the resistor is connected to Pin 39 -GND for Model B+ (or Pin 25 for Model B)
The files to copy are from the openhab bindings .zip file which is downloadable from the openhab.org website.
The filenames are:
org.openhab.io.gpio*
org.openhab.binding.gpio*
* indicates the release suffix.
An item entry is as simple as:
Switch gpio_led17 "LED17" { gpio="pin:17" }
A sitemap entry is as simple as:
Switch item=gpio_led17
For the Raspberry Pi the GPIO number scheme is the assigned GPIOxx pin name and not the physical pin number.
e.g. Pin 11 of the expansion header is GPIO17
Be aware that when shutting down openhab you'll need to unexport the GPIOs used by openhab to free them up so they can be reinitialised by openhab if you should decide to restart openhab.
Notes:
The /sys/class/gpio is a standard Linux feature and is not specific to the Raspberry Pi. What is specific to the Raspberry Pi are the actual GPIOs present.
echo 17 > /sys/class/gpio/export can be used to export GPIO17
echo out > /sys/class/gpio/gpio17/direction can be used to set the GPIO17 as an output pin
echo 1 > /sys/class/gpio/gpio17/value can be used to set the output pin high
echo 0 > /sys/class/gpio/gpio17/value can be used to set the output pin low
echo 17 > /sys/class/gpio/unexport can be used to unexport GPIO17
This is applicable to other GPIOs