tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
604 stars 188 forks source link

irremote not working properly using Arduino Uno #412

Open LeonardsonCC opened 2 years ago

LeonardsonCC commented 2 years ago

Hey, I'm new to embedded stuff, so maybe I have made some mistake.

Trying to make the IR Remote driver to work using an Arduino Uno, it just not received any signal. Debugging the driver code, I notice that if I use the Pin Mode as Input, and change the SetInterrupt to just call pinChange each 10 milliseconds, it receives the controller inputs.

There's any reason for the SetInterrupt and the Pin Mode as InputPullup to not work on Arduino Uno?

Checking Arduino docs, the pins 2 and 3 should be working, right?

neildavis commented 2 years ago

Hi @LeonardsonCC which IR receiver component are you using with the Uno? Can you provide the part number and/or link to the datasheet? Thanks.

LeonardsonCC commented 2 years ago

Hi, I believe it is this one: http://eeshop.unl.edu/pdf/VS1838-Infrared-Receiver-datasheet.pdf

neildavis commented 2 years ago

Thanks. If I'm reading that datasheet correctly, it's an 'active low' device so the driver config should be compatible. I have a R3 Uno somewhere so will try it soon once I have done some maintenance on my tinygo setup. I'm assuming you were using tinygo v0.23 at the time of reporting?

neildavis commented 2 years ago

Ah, having got the dev env setup, now I see. It seems SetInterrupt() is not implemented in machine.Pin for arduino target, which is more of a tinygo core support issue than a problem with the driver per se. That is a shame though, since as you point out the hw support is there on some pins at least.

I'd suggest opening an issue on the tinygo core similar to this one to ask for arduino/avr support for GPIO interrupts. You're possibly more likely to get a better response over there on why it's not available and/or possible.

LeonardsonCC commented 2 years ago

Oh, got it. Thanks for the really helpful explanation. I'll create the issue!