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()