Skip to content

A Particle library enabling communication with LEGO Power Functions IR Receiver.

License

Notifications You must be signed in to change notification settings

olaven/lego-power-functions-receiver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lego-power-functions-receiver

A Particle library for controllling the Lego Power Functions IR Receiver.

Credit where credit is due: This library is based on jurriaan's code as well as the 1.2 specification of the ir receiver. Thanks!

Usage

This library enables communication with the IR receiver.

#include "lego-power-functions-receiver.h"

const int ir_led_pin = D0; 
LegoPowerFunctions lpf(ir_led_pin, channel, LPF_RECEIVER_BLUE);

void setup() {
  Serial.begin(9600);
  lpf.step_forwards();  
}

void loop() {

  lpf.go();
}

See the examples folder for more details.

Documentation

This is a library that enables control of a Lego Train. Just like a the remote, but programatically, through Particle.

Arguments

  1. ir_led_pin: the pin of the IR LED, on your Particle device
  2. channel: Must match the selected channel on the receiver (1-4)
  3. output: The receiver has one red and one blue output, respectively: LPF_RECEIVER_RED and LPF_RECEIVER_BLUE

Methods

  • .go, sends signal to move at selected speed
  • .step_forwards increases speed, until maximum
  • .step_backwards decreases speed, until minimum
  • .stop sends signal to stop

Contributing

Here's how you can make changes to this library and eventually contribute those changes back.

To get started, clone the library from GitHub to your local machine.

Change the name of the library in library.properties to something different. You can add your name at then end.

Modify the sources in and with the new behavior.

To compile an example, use particle compile examples/usage command in Particle CLI or use our Desktop IDE.

After your changes are done you can upload them with particle library upload or Upload command in the IDE. This will create a private (only visible by you) library that you can use in other projects. Do particle library add lego-power-functions-receiver_myname to add the library to a project on your machine or add the lego-power-functions-receiver_myname library to a project on the Web IDE or Desktop IDE.

At this point, you can create a GitHub pull request with your changes to the original library.

If you wish to make your library public, use particle library publish or Publish command.

LICENSE

Copyright 2020 @olaven

Licensed under the license

About

A Particle library enabling communication with LEGO Power Functions IR Receiver.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages