frankred Posted December 28, 2022 at 12:24 PM Posted December 28, 2022 at 12:24 PM 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() Quote
photron Posted January 2, 2023 at 10:40 AM Posted January 2, 2023 at 10:40 AM 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) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.