Approved content
The content below is provided by a partner.
Recording commands from LEGO Power Functions remote controls and playing them. Using IR Receiver Module Iduino ST1089 and IR 940 nm emitting diode.
LEGO Power Functions RC documentation: https://www.philohome.com/pf/LEGO_Power_Functions_RC.pdf
Sometimes program registers more commands because some commands are missed by LEGO PF receiver.
Lighting the diode and the IR receiver with sunlight :sunny: or from an ordinary light bulb :bulb: may interfere with the signal reception.
Initialize recorder.
pfRecorder.init(
DigitalPin.P2,
AnalogPin.P0,
PfReceiverChannel.Channel2,
false
)
irReceiverPin
- the digital pin where IR Receiver Module is connected, eg: DigitalPin.P2irTransmitterPin
- the analog pin where IR diode is connected, eg: AnalogPin.P0recorderControlChannel
- the channel (0-3) for controlling recorder from PF remote control, eg: 1skipAllStop
- if true, in Combo Direct Mode skips state: Red Float, Blue FloatReturns commands list in reversed order.
let commandsInReversedOrder = pfRecorder.reverseOrder(recordedCommands);
commands
- the recorded commandsProcesses and returns command list reversing only commands from given channel and output.
let reversedCommands = pfRecorder.reverseCommands(recordedCommands, 0, 0);
commands
- the recorded commandschannel
- the channel (0-3), eg. 0output
- the output: 0 (Red), 1 (Blue), eg. 0Plays commands recorded by PF Receiver extension.
pfRecorder.play(commands)
commands
- the array with data of recorded commandsStops playing commands and stops all used outputs channels.
pfRecorder.stopPlaying()
pfRecorder.init(
DigitalPin.P2,
AnalogPin.P0,
PfReceiverChannel.Channel2,
false
)
LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this project.
Copyright (C) 2021 Adam Orczyk
Licensed under the MIT License (MIT). See LICENSE file for more details.
PF Recorder=github:aorczyk/pf-recorder#v0.0.2