pcmola/lego-magic-train

Using an ultrasonic sensor, I created a piece of moving a LEGO train.

The train speeds up when I put my hand close to the sensor. If I move my hand away from the sensor, it slows down.

Snapshotarrow-up-right

Snapshotarrow-up-right

Prerequisite

You must have PowerFunctions.cpp, PowerFunctions.h file in advance.

These files could be downloaded at https://github.com/jurriaan/Arduino-PowerFunctionsarrow-up-right .

Bill Of Materials

Label

Part Type

LED1

Red (633nm) LED

R1

220Ω Resistor

Part1

KY-005 Infrared Transmitter Module

Part2

HC-SR04 Ultrasonic Sensor

Part3

Arduino Uno (Rev3)

Circuit

Image Of Circuitarrow-up-right

Movie

YouTube - Controlling Lego Train By Palmarrow-up-right

References

[1] HC-SR04 Ultrasonic Sensorarrow-up-right

[2] Lego Power Functions Infrared Control for Arduinoarrow-up-right

Full Explanation Page

https://blog.naver.com/pcmola/221195632598arrow-up-right

Last updated