The IO-4 Bricklet can be used to extend the features of Bricks by external digital inputs and outputs.
The Bricklet features 4 I/O pins that can be independently configured as digital inputs or outputs. Each input pin can additionally be configured with a pull-up or as interrupt source. Via terminal blocks all signals can be accessed. Two additional terminal blocks deliver 3.3V and GND.
Human interfaces, such as switches, push-buttons and LEDs are typical applications of this Bricklet.
Hardware version 1.1 adds GND pins nearby the 4 I/O pins to allow easier access between I/O pins and GND.
| Property | Value |
|---|---|
| I/O Pins | 4 |
| I/O Voltages | Fixed 3.3V |
| Maximum Output Current | 6mA |
| Maximum API Calls* | set_value (1kHz), get_value (0.5kHz), callbacks (1kHz) |
| Dimensions (W x D x H) | 35 x 35 x 14mm (1.38 x 1.38 x 0.55”) |
| Weight | 14g |
* depends on your system (OS, CPU etc.)
To test the IO-4 Bricklet you need to have the Brick Daemon and the Brick Viewer installed (for installation guides click here and here) and the Brick Viewer has to be connected to the Brick Daemon.
Connect the IO-4 Bricklet to a Brick with the supplied cable. In our test we connected an LED with series resistor to the board by attaching the anode to pin 3 and the cathode to a GND pin. Additionally we connected a slide switch that can short pin 0 to GND (see picture below).
Starting from hardware version 1.1 you can also use the GND pins directly beside the I/O pins.
If you connect the Brick to the PC over USB, you should see a new tab named “IO-4 Bricklet” in the Brick Viewer after a moment. Select this tab.
If everything went as expected the Brick Viewer should look as depicted below.
In this tab you can change the “Debounce Period”, it is the debounce time for interrupt callbacks. For example: If you set this value to 100, you will get interrupts maximal every 100ms. This is necessary if something that bounces is connected to the IO-4 Bricklet, such as a button. You can test the optimal value in the Brick Viewer and use it later in your own program.
Below the debounce period configuration you can configure the pins. Each pin can be configured as input/output and in case of an input pin as pull-up. The current state is depicted in the table below.
To test the LED we configure pin 3 as output and change the value. When the pin is high the LED should light up. To test the button configure pin 0 as input pull-up. We need the pull-up to define a stable state when the slide switch does not short pin 0 to GND. Now look in the table, you should see that you can change the value of the pin by toggling the slide switch.
If you don’t have a button or a LED you can try to measure voltages with a voltage meter or connect an input pin with GND or VCC to see changes in the Brick Viewer.
After this test you can go on with writing your own application. See the Programming Interface section for the API of the IO-4 Bricklet and examples in different programming languages.
See High Level Programming Interface for a detailed description.
| Language | API | Examples | Installation |
|---|---|---|---|
| Modbus | API | ||
| TCP/IP | API | ||
| C/C++ | API | Examples | Installation |
| C# | API | Examples | Installation |
| Delphi | API | Examples | Installation |
| Java | API | Examples | Installation |
| PHP | API | Examples | Installation |
| Python | API | Examples | Installation |
| Ruby | API | Examples | Installation |
| VB.NET | API | Examples | Installation |