Turns out that all buttons on my TV remote are used and needed.......but, if I press the "mute" button twice, it doesn't change the state of the TV and allows me to control my lamp. Double press on, double press off. cicciocb has made it very easy to decipher most any IR remote button press and record the code. I then lucked out and found a combo ESP8266 board which had the necessary infrastructure to minimize wiring. I also used the VS1838B sensor provided in the "Help" file. Total cost was about $9 CAD.
Code: [Local Link Removed for Guests]
CODE: xxxx.bas
--------------------------------------------------------------------------------
'Zims IR lamp control
'gosub learn_code ' unmark this line and restart to find codes XXXXXXXXXXXXXXXXXXXXXXXXXX
cls
D1 = 5
D5 = 14
PIN.MODE D1, OUTPUT 'relay control for Lamp or any mains appliance
PIN(D1)= 0
ir.init D5
code$ = ""
togL = 0 'used for double press activation
OnInfrared irReceived
wlog "lite off"
wait
irReceived:
code$ = ir.get$
timer0 1000, clear 'resets press count after 1 second
pause 100
' 290 is the Sony TV code for the mute button
if (code$ = "290") then togL = togL + 1 'counts presses
pause 100
if (code$ = "290")and(togL = 2) gosub lite
pause 100
return
lite:
PIN(D1)= 1 - PIN(D1) 'toggles lite (thanks cicciocb)
if pin(D1) = 0 then wlog "lite off" else wlog "lite on"
return
clear:
timer0 0
togL = 0
return
' The below code is used to display the remote code from your IR remote
learn_code:
wlog "press a button on the remote and see code displayed here"
D5 = 14
ir.init D5
code$ = ""
OnInfrared irfind
wait
irfind:
code$ = ir.get$
pause 100
wlog code$
return