ESP8266 BASIC Universal learning IR Remote.
Posted: Sun Oct 02, 2016 7:47 pm
Hello,
Here is an example of how to create a universal learning ir remote.
Codes and button text are stored persistently in flash memory so that they are remembered after reboot.
This could be extended to be prettier with css or to add more buttons.
Works with NEC or SONY ir codes only.
IR receiver is hood to gpio 5 and the ir led is hood to gpio 4.
Will only work with latest version.
Here is an example of how to create a universal learning ir remote.
Codes and button text are stored persistently in flash memory so that they are remembered after reboot.
This could be extended to be prettier with css or to add more buttons.
Works with NEC or SONY ir codes only.
IR receiver is hood to gpio 5 and the ir led is hood to gpio 4.
Will only work with latest version.
Code: Select all
dim irButtons(6) as string
dim irCodes(6) as string
x = 0
ir.recv.setup(5)
ir.send.setup(4)
IRBRANCH [received]
for x = 1 to 6
irButtons(x) = read("irbut" & str(x))
irCodes(x) = read("ircode" & str(x))
if irButtons(x) = "" then irButtons(x) = "UNUSED"
next x
[top]
cls
Print "ESP8266 Basic Learning IR remote"
print "Last IR recvd"
textbox ircode
print "Text for button"
textbox newtxt
print "Button number"
dropdown x, "1,2,3,4,5,6"
Button "Program Code to button", [program]
print
button irButtons(1), [bu1]
button irButtons(2), [bu2]
button irButtons(3), [bu3]
print
button irButtons(4), [bu4]
button irButtons(5), [bu5]
button irButtons(6), [bu6]
IRBRANCH [received]
wait
[received]
ircode = ir.recv.full()
return
[bu1]
ir.send(irCodes(1))
x = 1
wait
[bu2]
ir.send(irCodes(2))
x = 2
wait
[bu3]
ir.send(irCodes(3))
x = 3
wait
[bu4]
ir.send(irCodes(4))
x = 4
wait
[bu5]
ir.send(irCodes(5))
x = 5
wait
[bu6]
ir.send(irCodes(6))
x = 6
wait
[program]
irButtons(x) = newtxt
irCodes(x) = ircode
write("irbut" & str(x),irButtons(x) )
write("ircode" & str(x),irCodes(x))
goto [top]