Programming Interface – Tinkerforge

- Getting Started
  - Primer
  - Tutorials
  - FAQ
- Hardware
  - Bricks
  - Bricklets
  - Master Extensions
  - Power Supplies
  - Accessories
  - Timeline
- Software
  - Brick Daemon (brickd)
  - Brick Viewer (brickv)
  - API Bindings
  - Firmwares and Plugins
  - Device Identifier
  - Source Code and Bug Tracking
  - Programming Interface
- Starter Kits
  - Weather Station
  - Hardware Hacking
  - Server Room Monitoring
  - Blinkenlights
  - Internet of Things
  - Camera Slider
- Embedded Boards
  - Raspberry Pi
- Specifications
  - Technical Data
  - TCP/IP Protocol
  - Modbus Protocol
  - Wireshark Dissector

# Programming Interface

The Programming Interface uses preprogrammed devices (Bricks and Bricklets) that can be controlled by an (embedded-) PC, tablet or smart phone. Each device has its own unique identifier (UID).

The user calls a function implemented in the API Bindings on a UID specified device. This function creates a TCP/IP data package which will be delivered to the Brick with the corresponding UID.

If this Brick is connected via USB to a computer, a program called Brick Daemon has to be installed. It acts as a translator between TCP/IP and USB. Some Master Extensions can be used to create a direct TCP/IP connection without the need of another computer in between. One example for it is the WIFI Extension.

After receiving a package, the Brick performs the task specified in the delivered data. For example in case of a `getTemperature()` call the Brick will read the temperature and send it back. The initial function call blocks until the data package is received and returns the temperature.

In case of calling a Bricklet function, data is send to the Brick where the Bricklet is attached. The Brick calls the corresponding function.

The Bricklet function called, is initially stored together with other data e.g. UID (together called plugin), in the EEPROM on the Bricklet. At start up, this function (with other Bricklet functions if any) is loaded (as position independent code) into the connected Brick Flash (see Building a Bricklet plugin). When the Brick calls the corresponding Bricklet function, this function is already loaded inside the Bricks Flash. This generic approach makes it possible to have compatibility between all Bricks and Bricklets, including future ones.

The Programming Interface is available for Windows, Linux and Mac OS X as well as mobile operating systems, such as Android, iOS and Windows Phone.

Note

See this tutorial for more information on how to use it and an idea of the Brick and Bricklet concept.

The content of this page is licensed under Creative Commons Attribution 3.0 Unported License.