laser module 激光模块(摩斯密码)和七彩灯 树莓派3

laser module 激光模块,因为光谱非常窄,仅能发出单色光,具有良好的指向性和能量集中性。这个让我想起小时候玩的激光,还能投射各种图案。文章内容为:模块原理图,模块接线图,相关代码。

laser module

模块头部可以调整焦距,调节焦点:

laser module

模块接线图:

laser module

激光模块代码(闪烁sos):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
                                                      //激光模块的代码,闪烁sos求救信号
#include <wiringPi.h>
#include <stdio.h>
#define LaserPin 0
int main(void)
{
if(wiringPiSetup() == -1){
printf("setup wiringPi failed !");
return 1;
}
pinMode(LaserPin, OUTPUT);
while(1){ //符号's'莫斯码'...'
digitalWrite(LaserPin, LOW); //拉低信号(接地)亮灯'.'
delay(500); //'.'的时间为1t
digitalWrite(LaserPin, HIGH); //拉高电平灭灯
delay(500); //'.'与'.'或'-'间的时间为1t
digitalWrite(LaserPin, LOW);
delay(500);
digitalWrite(LaserPin, HIGH);
delay(500);
digitalWrite(LaserPin, LOW);
delay(500);
digitalWrite(LaserPin, HIGH);
delay(1500); //符号间的时间3t('s'与'o'间)
//符号'o'摩斯码'---'
digitalWrite(LaserPin, LOW); //亮灯'-'
delay(1500); //'-'的时间为3t
digitalWrite(LaserPin, HIGH);
delay(500); //'-'与'-'时间间隔1t
digitalWrite(LaserPin, LOW);
delay(1500);
digitalWrite(LaserPin, HIGH);
delay(500);
digitalWrite(LaserPin, LOW);
delay(1500);
digitalWrite(LaserPin, HIGH);
delay(1500); //'o'与's'的间隔3t
//符号's'
digitalWrite(LaserPin, LOW);
delay(500);
digitalWrite(LaserPin, HIGH);
delay(500);
digitalWrite(LaserPin, LOW);
delay(500);
digitalWrite(LaserPin, HIGH);
delay(500);
digitalWrite(LaserPin, LOW);
delay(500);
digitalWrite(LaserPin, HIGH);
delay(3500); //'sos'完毕间隔下一个'sos'5t或7t
}
return 0;
}

七彩灯不需要代码运行,灯内集成有ic,通电自己运行.有慢闪快闪等.

放大一下看看

再大

又大了

laser module

LASER MODULE原理图下载链接(OneDrive):

LASER MODULE原理图

树莓派3更多模块请点击链接:

从入门到放弃的学习RASPBERRYPI