I like your project. I have also an old lego train and an arduino. The idea to combine these two is really great. There are two things that come to my mind. Maybe they are helpful. The two different values make sense if you look at the binary expressions. Power for example is 12 or 2060. In binary 1100 and 100000001100. Thus, the twelfth bit flips with each key press. So holding the key can be distinguished from a renewed press. Instead of using an if statemente to subtract 2048 you can also use the modulo function. For example: codevalue = codevalue % 2048 or shorter: decode_command(results.value % 2048). This would be little bit faster.
Another great tutorial!! But one thing, why are you stuck on the old 9V Lego standard??? A tutorial on how to program the Arduino for PF functions would be nice!! Thanks again mate!
Excellent tutorials! I was worried my son was getting too old for his lego train but now he can start programming. You will hate this but we need to add some manual control to Arduino. Can we use Arduino Serial Monitor to control the trains? void setup() Serial.println(" enter G to start train, enter S to stop train") void loop() { if (Serial.available()) { char ch = Serial.read(); if (ch = 'G') { lego.SingleOutput(0, PWM_FWD4, BLUE CH1); if (ch = 'S') { lego.SingleOutput(0, PWM_FLT, BLUE CH1); } } } So that if we press 5 or 6 etc the speed increases... thanks - pete
been into arduino for ages but just got into Lego trains. Love your tutorials mate! thanks heaps!
I like your project. I have also an old lego train and an arduino. The idea to combine these two is really great.
There are two things that come to my mind. Maybe they are helpful.
The two different values make sense if you look at the binary expressions. Power for example is 12 or 2060. In binary 1100 and 100000001100.
Thus, the twelfth bit flips with each key press. So holding the key can be distinguished from a renewed press.
Instead of using an if statemente to subtract 2048 you can also use the modulo function. For example: codevalue = codevalue % 2048 or shorter: decode_command(results.value % 2048). This would be little bit faster.
+Martin Meise This is a great piece of advice, and it's why I like working with Arduinos so much - the community is fantastic. Thanks very much!
Thank you so much for these tutorials.
Another great tutorial!! But one thing, why are you stuck on the old 9V Lego standard???
A tutorial on how to program the Arduino for PF functions would be nice!!
Thanks again mate!
Cool video!
***** Thanks!
hey thank for this video..can you plz tell me from where i can buy this lego train ! thanks again
Excellent tutorials! I was worried my son was getting too old for his lego train but now he can start programming.
You will hate this but we need to add some manual control to Arduino. Can we use Arduino Serial Monitor to control the trains?
void setup()
Serial.println(" enter G to start train, enter S to stop train")
void loop()
{
if (Serial.available())
{
char ch = Serial.read();
if (ch = 'G')
{
lego.SingleOutput(0, PWM_FWD4, BLUE CH1);
if (ch = 'S')
{
lego.SingleOutput(0, PWM_FLT, BLUE CH1);
}
}
}
So that if we press 5 or 6 etc the speed increases...
thanks - pete
I probably should've mentioned this before: I don't speak British; I'm American.
You have my sincerest condolences.
Thank you. Do you think you could make an American version of these videos? I'm not really one to be sitting with a crumpet and a cup of tea.
+Iron Horse Studios I'm sorry, but programming an Arduino requires a basic understanding of class structures.
Thanks anyways. :)
Iron Horse Studios o
hi i have a problem with the programm code
+Dj M1K3 What's the problem?
i don't know. i write the same code from this tutorial
+Dj M1K3 So what is the problem? Does the code compile? What do ypu see in Serial Monitor when you use remote control?
the problem is it didn't wan't upload on the arduino mega 2560
+Dj M1K3 What error did the IDE say? And do you have the correct library installed?
Hi