#Hi. Suggestions for decoding IR button

1 messages · Page 1 of 1 (latest)

muted oyster
#

This results in an icon showing when I push a button on an IR remote.
let lastSignal = 0
basic.forever(function () {
let currentSignal = pins.digitalReadPin(DigitalPin.P0)
if (currentSignal == 0 && lastSignal == 1) {
basic.showIcon(IconNames.Happy)
}
lastSignal = currentSignal
})

topaz prairie
#

If it's the one with the GRY that one is annoying to wire correctly but if it wasnt wired correctly (ie: power to GND, GND to power) it would be always on also a led on it supposed to light up when it receive something even before your code

#

are you seeing a led when you use the remote and is it connected to a PWM pin ?

#

anyway when Im back from work maybe I can help double check the wiring with you if it's the one with pins saying G R Y

#

is that the one u have: ? I use elegoo stuff too

topaz prairie
#

so yeah the top-left thingie on the far-left side of the breakout is a led, just tried it light up when it gets an IR wave

#

I dont know makecode but what I know is that everytime you press a touch on your remote you should get a stream of bits

#

In there there should be a keycode and in your code you would associate a keycode with an action you want to do. Like Power button on the remote could be 81740

#

so the ir receiver would says they got a stream like 10011111101001100 cuz they are supposed to get the stream and send it in digital stream form

#

AFter that the next step would be to identify the exact protocol your remote uses to have 100% accuracy on keycode and other infos (like mine has a TV, VCR and AUX switch so the keycodes are the same, but there is a peripheral info the stream too)

#

That was my first project after doing all the arduino tutorial so hopefully I can help 🙂

#

Also going to asks the obvious , but you tried the microbits IR extension I guess ?

#

because that ir receiver is very common but just works a bit oddly

muted oyster
muted oyster