Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

The first three leds getting the correct color, but why is my callback function my_callback not beeing called?

 

#!/usr/bin/env python
# -*- coding: utf-8 -*-

HOST = "localhost"
PORT = 4223
UID = "Lc7" # Change XYZ to the UID of your LED Strip Bricklet 2.0
LED_AMOUNT = 493
CLEAR_MATRIX = [0,0,0] * LED_AMOUNT

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_led_strip_v2 import BrickletLEDStripV2

def clearAll():
	ls.set_led_values(0, CLEAR_MATRIX)

def remove(index):
	ls.set_led_values(index, [0,0,0])

def set(index, r,g,b):
	ls.set_led_values(index, [r,g,b])

def my_callback():
	print('my callback called')

if __name__ == "__main__":
    ipcon = IPConnection()
    ls = BrickletLEDStripV2(UID, ipcon)
    ipcon.connect(HOST, PORT) 

    ls.set_frame_started_callback_configuration(True)
    ls.set_channel_mapping(BrickletLEDStripV2.CHANNEL_MAPPING_RGB)
    ls.set_frame_duration(100)
    ls.register_callback('my_callback', my_callback)
    ls.set_led_values(0, [255, 0, 0, 0, 255, 0, 0, 0, 255])

    input("Press key to exit\n")

    ipcon.disconnect()

 

Geschrieben

There is not my_callback callback, that's why its not called. There is only the CALLBACK_FRAME_STARTED callback.

def cb_frame_started(length):
    print('cb_frame_started', length)

ls.register_callback(BrickletLEDStripV2.CALLBACK_FRAME_STARTED, cb_frame_started)

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.