实验介绍
由于其良好的指向性和能量集中性,激光广泛应用于医疗,军事等领域。顾名思义,激光发射模块是一种可以发射激光的模块。
实验组件
1.Arduino Uno 主板
2.USB数据线
3.激光发射器模块
4.跳线若干
实验原理
激光是一种通过基于受激发射的电磁辐射的光学放大过程发光的装置,激光与其他光源不同,因为它们相干发光。
空间相干性使得激光可以聚焦到狭小的地方,从而使激光切割和光刻等应用以及激光束在很远的距离保持狭窄(准直),从而实现激光指示器等应用。激光器还可以具有高时间相干性,这使得它们具有非常窄的光谱,即它们仅发出单色光。它的时间相干性可以用来产生短至飞秒的光脉冲。
实物接线图
连接说明:激光传感器直接两个接口,中间接口不用,激光传感器的VCC端连接Arduino Uno主板的+5V,激光传感器的GND端连接Arduino Uno主板的“接地”端。
实验步骤
第一步:建立电路
第二步:程序(如下)
#include "retrieval.h"const int laserPin = 7; //laser attach to
static int dotDelay = 200; //
void setup()
{
pinMode(laserPin, OUTPUT); //initialize laser as anoutput
Serial.begin(9600);
}
void loop()
{
char ch = 0; //store the character or digit read fromthe serial monitor
if(Serial.available() > 0) //is there anything to beread
{
ch = Serial.read(); //read a single letter fromserial monitor
}
morseSignal(ch); //flashes depend on the letter
}
//
void flashDot(char cha)
{
digitalWrite(laserPin, HIGH); //turn the laser on
if(cha == '.') //
{
delay(dotDelay);
}
else
{
delay(dotDelay * 3); //gap betweenletters
}
digitalWrite(laserPin, LOW);
delay(dotDelay); //gap between flashes
}
//
void flashSequence(char *sequence)
{
int i = 0;
while(sequence[i] != NULL)
{
flashDot(sequence[i]);
i++;
}
delay(dotDelay * 3);
}
//
void morseSignal(char ch)
{
if(ch >= 'a' && ch <= 'z')
{
flashSequence(letters[ch - 'a']);
}
else if(ch >= 'A' && ch <= 'Z')
{
flashSequence(letters[ch - 'A']);
}
else if(ch >= '0' && ch <= '9')
{
flashSequence(numbers[ch - '0']);
}
else if(ch == ' ')
{
delay(dotDelay * 4); //gap betweenwords
}
}
第三步:编译
第四步:将程序上传至Arduino Uno板
第五步:通过电脑串口调试控制
实验结果:你会发现从激光发射器模块里射出一条红线。
作者:贲天宝
声明:转载此文是出于传递更多信息之目的。若有来源标注错误或侵犯了您的合法权益,请作者持权属证明与本网联系,我们将及时更正、删除,谢谢。