Re: Lego-Fischertechnik.
Verfasst: 14 Nov 2022, 19:08
Sending multiple commands from the Fischertechnic TXT to the Lego hubs.
I use the color sensor on the Lego hub for this and the CMDs via the TXT PC screen buttons. The TXT sends the color data to the neo LEDs over an I2C connection. So with 1 color sensor, different commands can be recognized. With the scope I measured the delay. The scope is connected to the I2C line ( 2 channels) of the TXT and also to the Lego hub pin5 output (1 channel). A small Python program on the Lego side provides the feedback in this way. The delay is about 16 msec, values between 12 and 25 msec. The light pulse of the TXT is 25 to 30 msec. The TXT program is set to 25 msec. By reducing this value, you can easily see when the hub does not always respond to the narrow pulse. For the neoleds, I use a short string of 3 consecutive LEDs. The distance between the sensor and the neoleds is not critical. This measurement confirmed that the response times of the TXT and the Lego hub are quite small.
Here in the example I use 3 different colors but you can use more. For the color value of the neo LEDs you may have to do some searching. But the basic colors red, blue and green always work. Also the brightness for this is not critical.
The picture is a UHD image. So you can zoom in nicely to all the details.
I2C-to-hub-delay by Frans, on Flickr
Frans
I use the color sensor on the Lego hub for this and the CMDs via the TXT PC screen buttons. The TXT sends the color data to the neo LEDs over an I2C connection. So with 1 color sensor, different commands can be recognized. With the scope I measured the delay. The scope is connected to the I2C line ( 2 channels) of the TXT and also to the Lego hub pin5 output (1 channel). A small Python program on the Lego side provides the feedback in this way. The delay is about 16 msec, values between 12 and 25 msec. The light pulse of the TXT is 25 to 30 msec. The TXT program is set to 25 msec. By reducing this value, you can easily see when the hub does not always respond to the narrow pulse. For the neoleds, I use a short string of 3 consecutive LEDs. The distance between the sensor and the neoleds is not critical. This measurement confirmed that the response times of the TXT and the Lego hub are quite small.
Here in the example I use 3 different colors but you can use more. For the color value of the neo LEDs you may have to do some searching. But the basic colors red, blue and green always work. Also the brightness for this is not critical.
The picture is a UHD image. So you can zoom in nicely to all the details.
![Bild](https://live.staticflickr.com/65535/52499239832_abd490c1c3_b.jpg)
Frans