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

Arduino Project 002 - LED SOS Morse Code Singal

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

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.donstudio.cn/?id=252

标签: Arduino

相关文章

Arduino Project 014 - Light Sensor

Arduino Project 014 - Light Sensor

This project introduces a new component known as a Light Dependent Resistor, or LDR. As the name imp...

Arduino Project 023A - Liquid Crystal Displays - Autoscroll

Arduino Project 023A - Liquid Crystal Displays - Autoscroll

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

Arduino Project 028B - Basic Stepper Control (Unipolar)

Arduino Project 028B - Basic Stepper Control (Unipolar)

In this very simple project, you will connect up a stepper motor and then get the Arduino to control...

Arduino Project 011 - Piezo Sounder Alarm

Arduino Project 011 - Piezo Sounder Alarm

Arduino project - sounder and sensors : Include project 11 Piezo Sounder Alarm ,Project piezo sounde...

Arduino Project 018 - Dual Shift Register 8-Bit Binary Counter

Arduino Project 018 - Dual Shift Register 8-Bit Binary Counter

In Project 18, you will daisy chain (or cascade) another 74HC595 IC onto the one used in Project 17...

 Arduino Project 043 - SD CardTemperature Datalogger

Arduino Project 043 - SD CardTemperature Datalogger

Todady I made a simple Arduino datalogger using SD card and DHT11  relative humidity and t...