Description
IR is an pair of infrared photoelectric. Also from M5Go Kit, Contains 1x infrared emitter and 1x receiver.
IR remote control is widely used in consumer electronics,it can be used to operate devices such as a television set, DVD player, or other home appliance, from a short distance. Since this unit comes with emitter and receiver, you can practice not only onIR encode but also on IR decode.
Product Features
- 1x infrared emitter
- 1x infrared receiver
- Distance range: < 5m
- Software Development Platform: Arduino, UIFlow(Blockly,Python)
- Two Lego-compatible holes
Kit includes
- 1x IR Unit
- 1x Grove Cable
Learn
Example
1. Arduino IDE
The code below is incomplete. TO get the complete code, please click here.
#include <M5Stack.h>
// declaration
int cur_recv_value = 0;
// initialization
M5.begin();
pinMode(ir_recv_pin, INPUT);// receiver pin
pinMode(ir_send_pin, OUTPUT);// transmitter pin
digitalWrite(ir_send_pin, 1);// send infrared light
// read data
cur_recv_value = digitalRead(ir_recv_pin);// read the status of receiver
2. UIFlow
To get the complete code, please click here.
More information
Schematic
PinMap
M5Core(GROVE B) | GPIO36 | GPIO26 | 5V | GND |
IR Unit | Receiver Pin | Transmitter Pin | 5V | GND |