Code: Select all
sony = SONY_12( Pin(17, Pin.OUT, value = 0) )
addr = 0x1 # 0x1
data = 0x15 # 0x15
SleepTime = 0.12
TotalTime = 10
for n in range(int(TotalTime/SleepTime)) :
sony.transmit(addr, data)
time.sleep(SleepTime)
print("Done")
Here is my application : I am using a 4K Sony TV as a monitor. Annoyingly, when my computer display controller goes to sleep, the TV will not wake up when I juggle the mouse - it shuts itself off after some time when seeing no HDMI input. So, I have to keep the remote handy to turn it on. Instead, I have written a daemon for my Mac Mini that will send a message to the Pico over USB if I wiggle the mouse and the display is asleep. So, I only need the Pico to send the IR command for Power On ( which is 0x2E, not 0x15 BTW.) So, in theory, I only need to issue the command once. I guess I can just use this loop and issue it with 0.08 secs delay for 10 secs, that would be OK. But, it would be nice to understand why I need to set the delay in the above range for this to work at all.