Created
June 24, 2017 13:14
-
-
Save dglaude/f1d79015217f20951922e20a1139379b to your computer and use it in GitHub Desktop.
Source code for my test of IRLibCP. This control an RGB strip in infrared.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # IRLibCP by Chris Young. See copyright.txt and license.txt | |
| # Sample program for sending one value of NEC protocol. | |
| # See https://github.com/cyborg5/IRLibCP | |
| # | |
| # Adapted by David Glaude to send a command from a list in sequence at each press of A. | |
| # I use this to control an RGB strip from Circuit Playground Express. | |
| import digitalio | |
| import time | |
| import board | |
| import IRLib_P01_NECs | |
| mySend=IRLib_P01_NECs.IRsendNEC(board.REMOTEOUT) | |
| Address=0x0 | |
| Datas=[0xff02fd, 0xff1ae5, 0xff9a65, 0xffa25d, 0xff22dd, 0xff02fd] | |
| Index=0 | |
| pin = digitalio.DigitalInOut(board.BUTTON_A) | |
| print("Press A to send an IR command") | |
| while True: | |
| if pin.value : | |
| Data=Datas[Index] | |
| print("Sending NEC code index={} with address={}, and data={}".format(int(Index),hex(Address),hex(Data))) | |
| mySend.send(Data, Address) | |
| Index=Index+1 | |
| if Index == len(Datas): | |
| Index=0 | |
| time.sleep(0.5) | |
| time.sleep(0.05) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the video on Twitter: https://twitter.com/DavidGlaude/status/878604353636110337