IR Receiver
Overview
Can be used to receive infrared remote control signals, with an effective distance of 8 meters.
Technical Specifications
Operating voltage: VCC 3.3V -5V
Module dimensions: 24*48mm
Mounting: 2 plastic building block compatible through-holes
Data type: Triggered–1 Not triggered–0
Receiving distance: 8m
Pin Definition
Pin |
Definition |
|---|---|
GND |
Ground |
VCC |
Power |
DO |
Digital output |
NC |
Not connected |
Example Code
Set serial port baud rate to 115200bps. When defining serial port pins in the program, note that the module’s RX and TX need to be crossed with the main board’s RX and TX!
When an infrared modulated signal is received, the indicator LED on the module will blink.
Graphical code
from mpython import *
from ir_remote import IRDecode
remote = IRDecode(Pin.P0)
def remote_callback(_address, _command):
global re
oled.fill(0)
oled.DispChar(str(str('Received: ') + str(_command)), 0, 0, 1)
oled.DispChar(str(str('Address: ') + str(_address)), 0, 16, 1)
oled.show()
remote.set_callback(remote_callback)