Skip to content

Instantly share code, notes, and snippets.

@dglaude
Created June 24, 2017 13:14
Show Gist options
  • Select an option

  • Save dglaude/f1d79015217f20951922e20a1139379b to your computer and use it in GitHub Desktop.

Select an option

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.
# 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)
@dglaude

dglaude commented Jun 24, 2017

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment