当前位置:首页 > 科学研究 > 电子编程 > 正文内容

Arduino Project 002 - LED SOS Morse Code Singal

RonWang1年前 (2024-05-28)电子编程395

Arduino 电子编程--灯项目及控制,主要使用Arduino编程控制LED灯,实现基本控制Project 2 LED闪烁S.O.S信号。

项目2 Project 2 S.O.S Morse Signal

002 LED SOS Circuit

// LED connected to pin 10
// Project 2 - LED SOS Morse Singal 
/* Coding Ron Wang
   May 28th 2024
   Autaba support for coding hardware
 */
int ledPin = 10;
// run once, when the sketch starts
void setup()
{
 // sets the pin as output
 pinMode(ledPin, OUTPUT);
}
// run over and over again
void loop()
{
 // 3 dits
 for (int x=0; x<3; x++) {
 digitalWrite(ledPin, HIGH); // sets the LED on
 delay(150); // waits for 150ms
 digitalWrite(ledPin, LOW); // sets the LED off
 delay(100); // waits for 100ms
 }
 // 100ms delay to cause slight gap betyouen letters
 delay(100);
 // 3 dahs
 for (int x=0; x<3; x++) {
 digitalWrite(ledPin, HIGH); // sets the LED on
 delay(400); // waits for 400ms
 digitalWrite(ledPin, LOW); // sets the LED off
 delay(100); // waits for 100ms
 }
 // 100ms delay to cause slight gap betyouen letters
 delay(100);
 // 3 dits again
 for (int x=0; x<3; x++) {
 digitalWrite(ledPin, HIGH); // sets the LED on
 delay(150); // waits for 150ms
 digitalWrite(ledPin, LOW); // sets the LED off
 delay(100); // waits for 100ms
 }
 // wait 5 seconds before repeating the SOS signal
 delay(5000);
}

版权声明:本文为原创文章,版权归donstudio所有,欢迎分享本文,转载请保留出处!

本文链接:http://www.parentscn.com/?id=252

标签: Arduino

相关文章

Arduino Programming Basic - Bollean

Arduino Programming Basic - Bollean

Arduino 程序基础,介绍Arduino程序的基本组成,第一部分编写了10个例子,关于变量及变量名称,串口监视器,if循环,for循环,while循环等。第二部分介绍了函数,全局变量,局部变量和静...

Arduino Project 039 - Ultrasonic Distance Display

Arduino Project 039 - Ultrasonic Distance Display

Ultrasonic sensors measure distance by sending and receiving the ultrasonic wave. The ultrasonic sen...

 ​Arduino Project 051 - How to Connect Remote Control

​Arduino Project 051 - How to Connect Remote Control

Project 51 How to Connect Remote Control 4 Channel to Arduino// constants won't c...

Arduino Project 040 - Ultrasonic Distance Alarm

Arduino Project 040 - Ultrasonic Distance Alarm

The sensor consists of two primary components: a transmitter and a receiver . The transmitter is res...

 ​Arduino Project 049 - IR Remote Control

​Arduino Project 049 - IR Remote Control

Project 49 IR Remote Control/* Project 49 IR Remote Control  * C...

Arduino Project 008 - RGB LED Mood Lamp

Arduino Project 008 - RGB LED Mood Lamp

In the last project, you learned how to adjust the brightness of an LED using the PWM capabilities o...