-
Posts
4,716 -
Joined
-
Last visited
Content Type
Profiles
Forums
Gallery
Everything posted by JopieK
-
I see those quite often in Holland when I'm traveling to my work.
-
I fixed it! I used the Timer3 for the Arduino to enable both receiving IR and blinking at the same time. Timer3 is used by Arduino for the Tone library so I can't use that anymore but the simple tone support is not that useful for trains I guess. @ronenson: I'll do some experiments with the stripings.
- 15 replies
-
- Extended Power Functions
- Union Pacific
-
(and 2 more)
Tagged with:
-
I agree on the red stripe indeed! Maybe I should lower the gray bricks by one plate and then make the tiles red. Quite difficult though since it is so tiny. This is the source code: /** * File....... LEGO_PF_DemoLEGO_PF_Demo.pde * Author: J.A.Korten * JKSOFT Educational * johan.a.korten[-at-]gmail.com * Technical Education Consultant for Primary, Secondary and Higher Education * Date: 20-05-2010 * Version: 1.0 * * Special thanks to: * - H. Bouwman, Windesheim University of Applied Sciences * - Walter Anderson (writer of IRanalyzer for Arduino) * - SuperCow, who made an excellent IR sender for LEGO PF and helped with this software also * he gave me his LegoPfReceiver functions (but they didn't work for me...) * * Tested with: * Arduino Duemilanove * IR RECEIVERS, 38Khz: * - VISHAY TSOP4138 * - HERO HIM602H * - VISHAY TSOP2238 * - IRM38BL * Warning: those IR components often look the same but pinnings may differ... * So students (and others) what can I say more than: * RTFDS!!! (Read The Fine Data Sheet ;)) * * Note: This sketch and the LEGOPfIrFunctions heavily rely on the LEGO Power Functions RC 1.0 documentation bij LEGO Company, 01/2008 * LEGO doesn't endorse, sponsor or authorize this initiative, use at your own risk. */ #include <avr/interrupt.h> #include <avr/io.h> #include <MsTimer2.h> #include "LEGOPfIrFunctions.h" int IRpin = 2; int statusLed = 13; volatile int i = 0; char dummyvar; // to get Arduinoi IDE to include core headers properly /* MsTimer2 is a small and very easy to use library to interface Timer2 with humans. It's called MsTimer2 because it "hardcodes" a resolution of 1 millisecond on timer2 For Details see: http://www.arduino.cc/playground/Main/MsTimer2 */ // Switch on LED on and off each half second const int led_pin = LED_BUILTIN; // 1.0 built in LED pin var const int blinker = 7; const int gyro_0 = 8; const int gyro_1 = 9; volatile boolean gyro_out; volatile boolean doGyralite; volatile boolean doBlink; boolean changed = false; // moet eeprom value worden byte system_channel = 0; void setup() { Serial.begin(9600); Serial.println("LEGO Power Functions IR Remote"); LegoPFIrRxFunctions.initPfIr(IRpin); pinMode(blinker, OUTPUT); pinMode(gyro_0, OUTPUT); pinMode(gyro_1, OUTPUT); gyro_out = false; doGyralite = true; doBlink = true; MsTimer2::set(45, flash); // 500ms period MsTimer2::start(); } void loop() { digitalWrite(statusLed, LOW); if (digitalRead(IRpin) == HIGH) { if (LegoPFIrRxFunctions.crunchIRData(IRpin) == 1) { digitalWrite(statusLed, HIGH); int channel = LegoPFIrRxFunctions.getChannel(); int outputab = 0; int data = LegoPFIrRxFunctions.getData(); int mode = LegoPFIrRxFunctions.getMode(); outputab = LegoPFIrRxFunctions.getOutputAB(); system_channel = channel; // only for debugging!!!! Serial.print("CH:"); Serial.print(channel); Serial.print(" AB:"); Serial.print(outputab); Serial.print(" mode:"); Serial.print(mode); Serial.print(" data:"); Serial.print(data); if (channel == system_channel) { if (data == 1) { doGyralite = !doGyralite; if (doGyralite) { Serial.println("Toggle Gyralite on"); } else { Serial.println("Toggle Gyralite off"); digitalWrite(gyro_0, LOW); digitalWrite(gyro_1, LOW); } delay(1000); } else if (data == 2) { doBlink = !doBlink; if (doBlink) { Serial.println("Toggle Blinker On"); } else { Serial.println("Toggle Blinker Off"); digitalWrite(blinker, LOW); } delay(1000); } } } } } void flash() { i++; //static boolean output = HIGH; if ((i % 5 == 0) && doGyralite) { digitalWrite(gyro_0, gyro_out); digitalWrite(gyro_1, !gyro_out); } if ((i % 2 == 0) && doBlink) digitalWrite(blinker, gyro_out); // turn the LED on (HIGH is the voltage level) gyro_out = !gyro_out; if (i > 10) { i = 0; } }
- 15 replies
-
- Extended Power Functions
- Union Pacific
-
(and 2 more)
Tagged with:
-
Small servo's are a bit cheaper (3$ or so) for switches and level crossings :)
-
The EMD trains frequent this LEGO Train Forum now and then. Of course there is the EMD E8 Santa Fe Super Chief, but others like Tearloch already made EMD's as well! Today I want to present my finished EMD E9 model: A video demo can be found here: I connected an Arduino Pro Mini to the LEGO LiPo, I also connected the normal IR receiver to the LiPo and connected the Train motor to it. B.t.w. I ran out of gray wheels so unfortunately one gray wheel. I use the small PF remote to enable / disable the Mars light / gyrolite (depending on the brand ;)) and the orange blinker. The Arduino uses a custom LEGO PF Remote receiver sketch and a typical 940nm IR receiver. The left one shows the gyrating light (2 SMD LEDs), the blink light also has a small SMD LED connected to a simple (insulated) copper wire. A peek on the inside: The IR receivers are at the right, the small one sticks out a little bit, enough to receive IR signals.
- 15 replies
-
- Extended Power Functions
- Union Pacific
-
(and 2 more)
Tagged with:
-
Very nice!!! I should also create one, nice on my high school desk ;)
-
Bricks cracking... just from being connected to one another?
JopieK replied to Endgame's topic in General LEGO Discussion
I'm puzzled why they did not replace it for free then, they do in Europe / Holland! -
Lego Rail Transportation Society (LRTS) rolling stock and motive power
JopieK replied to Murdoch17's topic in LEGO Train Tech
Hi Murdoch, looks like you have a nice assortment! I like the color schemes! Like your idea of creating your own rail history and the story behind it! -
Bricks cracking... just from being connected to one another?
JopieK replied to Endgame's topic in General LEGO Discussion
they will replace it indeed, I had problems with Tiles in the Maersk train and they did replace it! -
Looks nice edsmith0075, did you use a real example?!
-
Indeed! especially the bottom one is very nice, now we have a good use for flex at last ;)
-
hope we will see some train related confirmations soon! Again police stations... I don't like the police (well... might be just because I don't like in Germany so I always need to be careful with my speed ;))
-
that looks stunning!!! great job!!! Hope LEGO will have a good look at it for next year ;)
-
Too bad you are quitting your 12V part of the LEGO hobby roaminstudio, will you at least remain a Train enthusiast?!
-
MOCs: Models of trains running in Hungary
JopieK replied to Ashi Valkoinen's topic in LEGO Train Tech
Impressive layout! Well done Ashi! -
PF -> 12v motor, safe limit for IR receiver
JopieK replied to roamingstop's topic in LEGO Train Tech
Probably Philipe knows this. I think it will be cut down though by LEGO, they make a lot of there stuff very tamper proof. So I think you would be safe, but I hope the voltage convertor for the PF receiver logic will not heat up too much. -
it is becoming very nice! I agree with zephyr that it the gray is indeed a bit busy for the eyes but apart from that it looks great!
-
very nice indeed! maybe you could even add some lights for in the dark?!
-
She is also into it, so she does, I selected her on that (actually kidding about that ;)) she has the more expensive sets I'm afraid ;)
-
A capacitor is a small battery like component so that will be impossible. For a flashing like you would need a mono-stable multivibrator or something (that often also uses capacitors, but together with transistors): In this set they apparently use it with a motor: First you charge the capacitor by using the motor as a dynamo, then it will drive for some time.
-
Worth the cost to get into 9V now, with a huge investment in PF?
JopieK replied to Locutis's topic in LEGO Train Tech
Good to hear that Locutis, sometimes after all one finds out that things are less troublesome than they looked initially ;) -
MOC - Underground Portuguese Train (Metro Lisboa)
JopieK replied to Sérgio's topic in LEGO Train Tech
very, very nice indeed!... or better: just perfect!!! -
nice job! now he still needs to add chicken wings of nuggets (@TheLazyChicken ;))