Arduino for Lego Trains #7: Infra-red Remote Control

Поділитися
Вставка
  • Опубліковано 26 жов 2024

КОМЕНТАРІ • 27

  • @AxelTiger
    @AxelTiger 8 років тому +2

    been into arduino for ages but just got into Lego trains. Love your tutorials mate! thanks heaps!

  • @MartinMeise
    @MartinMeise 8 років тому +3

    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.

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  8 років тому

      +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!

  • @igormalicki4465
    @igormalicki4465 9 років тому +3

    Thank you so much for these tutorials.

  • @angelogiacon6499
    @angelogiacon6499 9 років тому +2

    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!

  • @multidomar
    @multidomar 9 років тому +2

    Cool video!

  • @boutainafl8280
    @boutainafl8280 4 роки тому +1

    hey thank for this video..can you plz tell me from where i can buy this lego train ! thanks again

  • @skipzoneskipzone6242
    @skipzoneskipzone6242 7 років тому +1

    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

  • @ironhorsestudios5068
    @ironhorsestudios5068 8 років тому +3

    I probably should've mentioned this before: I don't speak British; I'm American.

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  8 років тому +2

      You have my sincerest condolences.

    • @ironhorsestudios5068
      @ironhorsestudios5068 8 років тому +1

      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.

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  8 років тому +2

      +Iron Horse Studios I'm sorry, but programming an Arduino requires a basic understanding of class structures.

    • @ironhorsestudios5068
      @ironhorsestudios5068 8 років тому +1

      Thanks anyways. :)

    • @chelseapantelic687
      @chelseapantelic687 8 років тому +1

      Iron Horse Studios o

  • @djm1k312
    @djm1k312 7 років тому +2

    hi i have a problem with the programm code

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому +1

      +Dj M1K3 What's the problem?

    • @djm1k312
      @djm1k312 7 років тому +1

      i don't know. i write the same code from this tutorial

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому +1

      +Dj M1K3 So what is the problem? Does the code compile? What do ypu see in Serial Monitor when you use remote control?

    • @djm1k312
      @djm1k312 7 років тому +1

      the problem is it didn't wan't upload on the arduino mega 2560

    • @ArduinoLegoTrains
      @ArduinoLegoTrains  7 років тому +1

      +Dj M1K3 What error did the IDE say? And do you have the correct library installed?

  • @atanuhalder6892
    @atanuhalder6892 6 років тому +1

    Hi