Description
This is one of the communication devices among M5Units, a Laser emitter with adjustable focal length. It is mainly built with a laser diode
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.RX parallelly.
Port type of this unit is PORTB.
warning!!! laser is dangerous for human being, Don’t aim a laser pointer towards a person’s head. This is to prevent the beam from getting in their eyes, possibly causing eye damage. Remember that people can move unexpectedly, so keeping away from their heads is a good idea
Product Features
- Laser transmitter
- adjustable focal length
- Work voltage: 5V
- Pair with LASER.RX
- Two Lego-compatible holes
- Program Platform: Arduino, UIFlow(Blockly, Python)
Include
- 1x LASER.TX 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_TX | / | TX | 5V | GND |
Video
Demo