LEGO Powerfunctions example for Arduino #89
-
Dear all, I'd like to write a concise example for an LEGO Power functions Irsender. What I achieved already:
EDIT: Deleted my first approach for irsender sample code
Could anybody give me an advice ...
Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 8 replies
-
??? What is the output of ReceiveDemo example, for the code sent above? |
Beta Was this translation helpful? Give feedback.
-
@ArminJo Oh, ... I'm so sorry. In this first approach I used the IRremote lib, because there are explicit functions like sendLegoPowerFunctions. Now I know where I am ... Meanwhile, I connected two arduinos via LEGO protocol successfully, wrote the last paragraphs anew, made the questions I have more clear. |
Beta Was this translation helpful? Give feedback.
-
This evening brought success:
which is
This is also what i captured from the LEGO IR Remote. The LED in the LEGO Receiver is blinking now. That means it's recognizing a signal. I captured furthermore commands like 0x310, 0xB12, 0x354, 0x398, 0xB18. This means that sCommand has the type int instead of uint8_t, e.g.
sends a command 0x818, which is blue forward on Channel 1. And voila: The wheels are turning! |
Beta Was this translation helpful? Give feedback.
-
I took a closer look on the codes and analyzed them, what they could mean according to the LEGO Power Functions v1.20. The sCommand (as int) is actually a series of bits as groups of 4 bits, which are called a "nibble". This reads in natural language:
As far as I can see, my ir receiver from LEGO set 42095 understands only the very simple Combo direct mode with commands move forward, move backward and float. In this case it's a good starting point to use the numbers for Channel 1:
|
Beta Was this translation helpful? Give feedback.
-
I can prepare a gist now and post it later ... |
Beta Was this translation helpful? Give feedback.
-
Zum vorläufigen Abschluss habe ich das gist etwas angepasst:
|
Beta Was this translation helpful? Give feedback.
Zum vorläufigen Abschluss habe ich das gist etwas angepasst: