peterhinch / micropython_ir

Nonblocking device drivers to receive from IR remotes and for IR "blaster" apps.
MIT License
240 stars 51 forks source link

The issue is I can't see how to say Thanks! #18

Closed drgerg closed 2 years ago

drgerg commented 2 years ago

I'm sure this is the wrong place. But I'm doing it anyway.

Thanks! Thanks for building these drivers.

I'm using the ir_tx library on a Raspberry Pi Pico. All I wanted was to turn a display on when I booted a computer. Seemed simple enough. It only took me two years to find the Pico, and another 6 months or so to figure out how to get the code together to make it do the one task I had in mind.

Your driver was perfect. Although, (you knew that was coming, didn't you?) it was a mind-bending journey for me to finally figure out what values to put where to get the output I needed.

I needed to see E817C7EA followed by 6897C7EA, but I had no clue how in the world to go about getting those strings.

I was using this as the contents of main.py in the Pico:

from machine import Pin from ir_tx.nec import NEC nec = NEC(Pin(17, Pin.OUT, value = 0)) nec.transmit(1, 2)

That was giving me: FD02FE01 Not being a computer scientist, I could not figure out how to get from that string to the ones I needed. I beat my head bloody against that brick wall until I staggered into a discovery: putting 0x in front of the strings I needed would produce the numbers I needed. I'm sure seasoned programmers will get a chuckle out of that. Google was no help to me on that one, so I was quite proud of myself when I figured it out. ;-)

So here's my final main.py for the Pico to do the job I want it to do:

from machine import Pin from ir_tx.nec import NEC import time nec = NEC(Pin(17, Pin.OUT, value = 0)) addr = 0xc7ea DAT = 0x17 rpt = 0x6897 nec.transmit(addr,DAT) time.sleep(0.5) nec.transmit(addr,rpt)

I also stumbled upon the fact that the output was backward from what I expected. Instead of addrDAT, it transmitted DATaddr. I still don't know why that's the case, but it is, apparently.

At any rate, I wanted to say thanks, and to share these bits of info with anyone who might benefit.

Cheers!