Description
This is one of the communication devices among M5Units, a non-modulation Laser receiver. It is mainly built with a laser transistor.
Laser communications devices are wireless connections through the atmosphere. They work similarly to fiber-optic links, except the beam is transmitted through free space. While the transmitter and receiver must require line-of-sight conditions, they have the benefit of eliminating the need for broadcast rights and buried cables. Laser communications systems can be easily deployed since they are inexpensive, small, low power and do not require any radio interference studies. Two parallel beams are needed, one for transmission and one for reception. Therefore we have a LASER.TX parallelly.
Port type of this unit is PORTB.
## Product Features
- Laser receiver
- non-modulation
- Work voltage: 5V
- Pair with LASER.TX
- Response Frequency: 140KHz ~205KHz
- Two Lego-compatible holes
- Program Platform: Arduino, UIFlow(Blockly, Python)
Include
- 1x LASER.RX unit
- 1x GROVE cable
Application
- Laser communication system on space.
Learn
Code
1. Arduino IDE
To get complete code, please click here.
/* This demo is for LASER.TX and LASER.RX, utilized UART for transmittion and reception of
laser signals. In order to get the result of this demo, you will need to connect LASER.TX
and LASER.RX with PORTC(blue) respectively onto two different M5Cores with M5GO bases on
bottom. Then flash the demo into both M5Core device.
When testing the demo, you need to point the TX unit to RX, and press the button TX connected
device. RX connected device will reponse with a display,and will show what is received .
See this link for more detals: https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/Unit/LASER/EasyLoader_LASER_RX.exe
*/
#include <M5Stack.h>
char ch;
// serial 2 write and read
//#define RX
void setup() {
M5.begin();
Serial.begin(115200);
// Serial2.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert)
Serial2.begin(9600, SERIAL_8N1, 16, 17);
}
void loop() {
M5.update();
if (M5.BtnA.wasReleased()) {
ch = 'A';
Serial2.write(ch);
} else if (M5.BtnB.wasReleased()) {
ch = 'B';
Serial2.write(ch);
} else if (M5.BtnC.wasReleased()) {
ch = 'C';
Serial2.write(ch);
}
M5.update();
if(Serial2.available()) {
char ch = Serial2.read();
M5.Lcd.print(ch);
}
}
Pin Map
M5 PORTB | GPIO36 | GPIO26 | 5V | GND |
LASER_RX | RX | / | 5V | GND |
Video
Demo