### Execute Example with Installed Bindings Source: https://www.tinkerforge.com/en/doc/Software/API_Bindings_Ruby.html Command to run the configuration example when bindings are installed. ```bash ruby example_configuration.rb ``` -------------------------------- ### Install Bindings from Source Source: https://www.tinkerforge.com/en/doc/Software/API_Bindings_Python.html Use the setup script or pip to install the bindings from the source directory. ```bash python setup.py install ``` ```bash pip install . ``` -------------------------------- ### Execute PHP Example Source: https://www.tinkerforge.com/en/doc/Software/API_Bindings_PHP.html Command to run the configuration example script. ```bash php ExampleConfiguration.php ``` -------------------------------- ### Execute Node.js Example Source: https://www.tinkerforge.com/en/doc/Software/API_Bindings_JavaScript.html Command to run the configuration example script. ```bash node ExampleConfiguration.js ``` -------------------------------- ### Install Brick Daemon Source: https://www.tinkerforge.com/en/doc/Tutorials/Tutorial_Build_Environment/Tutorial.html Installation command for the compiled Brick Daemon. ```bash sudo make install ``` -------------------------------- ### Hello World Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/OLED64x48_Bricklet_Mathematica.html Demonstrates how to initialize the connection, clear the display, and write text to the OLED 64x48 Bricklet. ```Mathematica 1Needs["NETLink`"] 2LoadNETAssembly["Tinkerforge",NotebookDirectory[]<>"../../.."] 3 4host="localhost" 5port=4223 6uid="XYZ"(*Change XYZ to the UID of your OLED 64x48 Bricklet*) 7 8(*Create IPConnection and device object*) 9ipcon=NETNew["Tinkerforge.IPConnection"] 10oled=NETNew["Tinkerforge.BrickletOLED64x48",uid,ipcon] 11ipcon@Connect[host,port] 12 13(*Clear display*) 14oled@ClearDisplay[] 15 16(*Write "Hello World" starting from upper left corner of the screen*) 17oled@WriteLine[0,0,"Hello World"] 18 19(*Clean up*) 20ipcon@Disconnect[] 21ReleaseNETObject[oled] 22ReleaseNETObject[ipcon] ``` -------------------------------- ### Hello World Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/LCD20x4_Bricklet_Mathematica.html Demonstrates how to initialize the connection, turn on the backlight, and write text to the LCD 20x4 Bricklet. ```Mathematica 1Needs["NETLink`"] 2LoadNETAssembly["Tinkerforge",NotebookDirectory[]<>"../../.."] 3 4host="localhost" 5port=4223 6uid="XYZ"(*Change XYZ to the UID of your LCD 20x4 Bricklet*) 7 8(*Create IPConnection and device object*) 9ipcon=NETNew["Tinkerforge.IPConnection"] 10lcd=NETNew["Tinkerforge.BrickletLCD20x4",uid,ipcon] 11ipcon@Connect[host,port] 12 13(*Turn backlight on*) 14lcd@BacklightOn[] 15 16(*Write "Hello World"*) 17lcd@WriteLine[0,0,"Hello World"] 18 19(*Clean up*) 20ipcon@Disconnect[] 21ReleaseNETObject[lcd] 22ReleaseNETObject[ipcon] ``` -------------------------------- ### Get Frame Started Callback Receiver Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/RGBLEDMatrix_Bricklet_Rust.html Registers a receiver to handle frame started events, which trigger when a new frame write begins. ```rust pub fn RgbLedMatrixBricklet::get_frame_started_callback_receiver(&self) -> ConvertingCallbackReceiver ``` -------------------------------- ### Hello World Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/LCD16x2_Bricklet_PHP.html Demonstrates how to initialize the Bricklet, turn on the backlight, and write text to the display. ```php 1connect(HOST, PORT); // Connect to brickd 17// Don't use device before ipcon is connected 18 19// Turn backlight on 20$lcd->backlightOn(); 21 22// Write "Hello World" 23$lcd->writeLine(0, 0, 'Hello World'); 24 25echo "Press key to exit\n"; 26fgetc(fopen('php://stdin', 'r')); 27$ipcon->disconnect(); 28 29?> ``` -------------------------------- ### Dispatch Callback Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/Color_Bricklet_Shell.html General command to start receiving callbacks from the device. ```shell tinkerforge dispatch color-bricklet example ``` -------------------------------- ### Hello World Example in HTML Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/LCD16x2_Bricklet_JavaScript.html Demonstrates how to initialize an IPConnection, create a device object, and write text to the LCD 16x2 Bricklet. ```html 1 2 3 4 5 Tinkerforge | JavaScript Example 6 7 8
9

LCD 16x2 Bricklet Hello World Example

10

11 : 12 , 13 14 15

16

17 19

20
21 22 53 54 ``` -------------------------------- ### Hello World Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/OLED128x64_Bricklet_Mathematica.html Demonstrates how to initialize the OLED 128x64 Bricklet and write a simple text string to the display. ```Mathematica 1Needs["NETLink`"] 2LoadNETAssembly["Tinkerforge",NotebookDirectory[]<>"../../.."] 3 4host="localhost" 5port=4223 6uid="XYZ"(*Change XYZ to the UID of your OLED 128x64 Bricklet*) 7 8(*Create IPConnection and device object*) 9ipcon=NETNew["Tinkerforge.IPConnection"] 10oled=NETNew["Tinkerforge.BrickletOLED128x64",uid,ipcon] 11ipcon@Connect[host,port] 12 13(*Clear display*) 14oled@ClearDisplay[] 15 16(*Write "Hello World" starting from upper left corner of the screen*) 17oled@WriteLine[0,0,"Hello World"] 18 19(*Clean up*) 20ipcon@Disconnect[] 21ReleaseNETObject[oled] 22ReleaseNETObject[ipcon] ``` -------------------------------- ### Dispatch Callback Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/AmbientLightV3_Bricklet_Shell.html Starts the dispatching process to receive callbacks from the Bricklet. ```shell tinkerforge dispatch ambient-light-v3-bricklet example ``` -------------------------------- ### Dispatch Callback Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/AmbientLightV2_Bricklet_Shell.html General command to start dispatching callbacks from the Bricklet. ```shell tinkerforge dispatch ambient-light-v2-bricklet example ``` -------------------------------- ### Hello World Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/OLED64x48_Bricklet_Go.html Demonstrates how to initialize the Bricklet and write text to the display. ```go package main import ( "fmt" "github.com/Tinkerforge/go-api-bindings/ipconnection" "github.com/Tinkerforge/go-api-bindings/oled_64x48_bricklet" ) const ADDR string = "localhost:4223" const UID string = "XYZ" // Change XYZ to the UID of your OLED 64x48 Bricklet. func main() { ipcon := ipconnection.New() defer ipcon.Close() oled, _ := oled_64x48_bricklet.New(UID, &ipcon) // Create device object. ipcon.Connect(ADDR) // Connect to brickd. defer ipcon.Disconnect() // Don't use device before ipcon is connected. // Clear display oled.ClearDisplay() // Write "Hello World" starting from upper left corner of the screen oled.WriteLine(0, 0, "Hello World") fmt.Print("Press enter to exit.") fmt.Scanln() } ``` -------------------------------- ### LED Strip Bricklet 2.0 Callback Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/LEDStripV2_Bricklet_JavaScript.html This HTML example demonstrates how to connect to the Bricklet and register a frame started callback to monitor LED strip activity. ```html 1 2 3 4 5 6 7 8 Tinkerforge | JavaScript Example 9 10 11
12

LED Strip Bricklet 2.0 Callback Example

13

14 : 15 , 16 17 18

19

20 22

23
24 25 62 63 ``` -------------------------------- ### Hello World Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/LCD16x2_Bricklet_C.html Demonstrates how to initialize the Bricklet, turn on the backlight, and write text to the display. ```c 1#include 2 3#include "ip_connection.h" 4#include "bricklet_lcd_16x2.h" 5 6#define HOST "localhost" 7#define PORT 4223 8#define UID "XYZ" // Change XYZ to the UID of your LCD 16x2 Bricklet 9 10int main(void) { 11 // Create IP connection 12 IPConnection ipcon; 13 ipcon_create(&ipcon); 14 15 // Create device object 16 LCD16x2 lcd; 17 lcd_16x2_create(&lcd, UID, &ipcon); 18 19 // Connect to brickd 20 if(ipcon_connect(&ipcon, HOST, PORT) < 0) { 21 fprintf(stderr, "Could not connect\n"); 22 return 1; 23 } 24 // Don't use device before ipcon is connected 25 26 // Turn backlight on 27 lcd_16x2_backlight_on(&lcd); 28 29 // Write "Hello World" 30 lcd_16x2_write_line(&lcd, 0, 0, "Hello World"); 31 32 printf("Press key to exit\n"); 33 getchar(); 34 lcd_16x2_destroy(&lcd); 35 ipcon_destroy(&ipcon); // Calls ipcon_disconnect internally 36 return 0; 37} ``` -------------------------------- ### Dispatch Callback Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/PiezoBuzzer_Bricklet_Shell.html Use this command to start receiving callbacks from the Piezo Buzzer Bricklet. ```shell tinkerforge dispatch piezo-buzzer-bricklet example ``` -------------------------------- ### Hello World Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/OLED128x64V2_Bricklet_Mathematica.html Demonstrates how to connect to the Bricklet and write text to the display. Ensure the UID is updated to match the specific device. ```Mathematica 1Needs["NETLink`"] 2LoadNETAssembly["Tinkerforge",NotebookDirectory[]<>"../../.."] 3 4host="localhost" 5port=4223 6uid="XYZ"(*Change XYZ to the UID of your OLED 128x64 Bricklet 2.0*) 7 8(*Create IPConnection and device object*) 9ipcon=NETNew["Tinkerforge.IPConnection"] 10oled=NETNew["Tinkerforge.BrickletOLED128x64V2",uid,ipcon] 11ipcon@Connect[host,port] 12 13(*Clear display*) 14oled@ClearDisplay[] 15 16(*Write "Hello World" starting from upper left corner of the screen*) 17oled@WriteLine[0,0,"Hello World"] 18 19(*Clean up*) 20ipcon@Disconnect[] 21ReleaseNETObject[oled] 22ReleaseNETObject[ipcon] ``` -------------------------------- ### IMU Bricklet 3.0 All Data Example Source: https://www.tinkerforge.com/en/doc/Software/Bricklets/IMUV3_Bricklet_JavaScript.html Shows the initial setup for connecting to the Bricklet and establishing an IP connection. ```html 1 2 3 4 5 Tinkerforge | JavaScript Example 6 7 8
9

IMU Bricklet 3.0 All Data Example

10

11 : 12 , 13 14 15

16

17 19

20
21 22