This is the mirror repository. Original repository is hosted under:
https://github.com/gmamaladze/LegoRC.net
Let's assume you already assembled your favorite rover, railway or a robot using LEGO power functions. You might have used up to 8 motors, servos or LEDs. Every of 4 receivers is tuned to one of 4 channels and can be used to control 2 actuators. Controlling all that requires 4 IR transmitters or .. a Netduino + 1 x IR LED and this library.
Using this library is as simple a building LEGO.
Q: What is LEGO Power Functions?
An Infrared LED and an appropriate resistor
Add LegoRC.Net NuGet package to your project. Or alternatively clone this repository and add the project Lego.PowerFunctions.csproj
to your solution.
This trivial circuit will work with most of IR LEDs and for short distances. For longer distances you would probably need a better circuit. See: Infrared transmitter driver for Netduino.
Using this library is literally like building you LEGO vehicle. Like in the reality you are putting components together. Components which won't work together don't fit together.
public static void Main() { using (var transmitter = new Transmitter()) { //Firts vehiclle var receiverTrain = new Receiver(transmitter, Channel.Ch1); var motor = new Motor(receiverTrain.RedConnector); var light = new Led(receiverTrain.RedConnector); //Rover on another channel var receiverRover = new Receiver(transmitter, Channel.Ch2); var drive = new Motor(receiverRover.BlueConnector); var steeringWheel = new Servo(receiverRover.RedConnector); //Now Control while (true) { motor.IncSpeed(); light.TurnOn(); drive.SetSpeed(100); steeringWheel.SetAngle180(45); Thread.Sleep(10000); steeringWheel.Center(); motor.Brake(); light.TurnOff(); } } }