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

Arduino Project 002 - LED SOS Morse Code Singal

RonWang11个月前 (05-28)电子编程265

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 Project 027 - Joystick Servo Control

Arduino Project 027 - Joystick Servo Control

In this tutorial, we are going to learn how to use Arduino and a joystick to control two servo motor...

Books Exploring Arduino

Books Exploring Arduino

Exploring Arduino uses the popular Arduino microcontroller platform as an instrument to teach topics...

Arduino Project 012 - Piezo Sounder Melody Player

Arduino Project 012 - Piezo Sounder Melody Player

Rather than using the piezo to make annoying alarm sounds, why not use it to play a melody? You are...

C语言调试运行环境Pelles C的安装

C语言调试运行环境Pelles C的安装

C语言调试运行环境之TurboC一文介绍了在32位Windows系统下安装C语言运行环境之TubroC,但是由于TurobC只能在32位系统下运行,导致现在很多Windows10和Windows 11...

Arduino Project 023 - Liquid Crystal Displays - Hello World

Arduino Project 023 - Liquid Crystal Displays - Hello World

Before wiring the LCD screen to your Arduino board we suggest to solder a pin header strip to the 14...

Arduino Project 026 - Dual Servo Control

Arduino Project 026 - Dual Servo Control

This project you’ll create another simple project, but this time you’ll control two servos using com...