Approved content
The content below is provided by a partner.
MakeCode extension for Keyestudio Infrared Wireless Module Kit. The extension should also work with other with IR receivers and NEC compatible IR remotes.
The MakerBit connects to the BBC micro:bit to provide easy connections to a wide variety of sensors, actuators and other components.
![]() |
![]() |
---|---|
MakerBit | MakerBit+R with motor controller |
Connects to the IR receiver module at the specified pin and configures the IR protocol.
makerbit.connectIrReceiver(DigitalPin.P0, IrProtocol.Keyestudio)
pin
- digital pin with an attached IR receiverprotocol
- the IR protocol to be detected, for example IrProtocol.Keyestudio or IrProtocol.NECDo something when a specific button is pressed or released on the remote control.
makerbit.onIrButton(IrButton.Ok, IrButtonAction.Pressed, () => {})
button
- the button to be checkedaction
- the trigger actionhandler
- body code to run when the event is raisedReturns the code of the IR button that was pressed last. Returns -1 (IrButton.Any) if no button has been pressed yet.
makerbit.irButton()
Do something when a specific button is pressed or released on the remote control.
makerbit.onIrDatagram(() => {})
handler
- body code to run when the event is raisedReturns the IR datagram as 32-bit hexadecimal string. The last received datagram is returned or “0x00000000” if no data has been received yet.
makerbit.irDatagram()
Returns true if any IR data was received since the last call of this function. False otherwise.
makerbit.wasIrDataReceived();
Returns the command code of a specific IR button.
makerbit.irButtonCode(IrButton.Number_9)
button
- the buttonmakerbit.connectIrReceiver(DigitalPin.P0, IrProtocol.Keyestudio)
makerbit.onIrButton(IrButton.Ok, IrButtonAction.Released, function () {
basic.showIcon(IconNames.SmallHeart)
})
makerbit.onIrButton(IrButton.Ok, IrButtonAction.Pressed, function () {
basic.showIcon(IconNames.Heart)
})
basic.forever(function () {
if (makerbit.wasAnyIrButtonPressed()) {
basic.showNumber(makerbit.irButton())
}
})
Licensed under the MIT License (MIT). See LICENSE file for more details.
MakerBit-IR-Receiver=github:1010technologies/pxt-makerbit-ir-receiver#v1.5.14