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

Arduino Project 009 - LED Fire Effect

RonWang5个月前 (07-16)电子编程150

Project 9 will use LEDs and a flickering random light effect, via PWM again, to mimic the effect of a flickering flame. If you place these LEDs inside a house on a model railway, for example, you can make it look like the house is on fire, or you can use it in a fireplace in your house instead of wood logs. This is a simple example of how LEDs can be used to create special effects for movies, stage plays, model dioramas, model railways, etc.

 项目 9 Project 9 – LED Fire Effect

/* Coding Ron Wang
   July 16th 2024
   Autaba support for coding hardware
 */
// Project 9 - LED Fire Effect
int ledPin1 = 8;
int ledPin2 = 9;
int ledPin3 = 10;
void setup()
{
 pinMode(ledPin1, OUTPUT);
 pinMode(ledPin2, OUTPUT);
 pinMode(ledPin3, OUTPUT);
}
void loop()
{
 analogWrite(ledPin1, random(120)+135);
 analogWrite(ledPin2, random(120)+135);
 analogWrite(ledPin3, random(120)+135);
delay(random(100));
}

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

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

标签: Arduino

相关文章

Arduino Project 023B - Liquid Crystal Displays -Blink and Cursor

Arduino Project 023B - Liquid Crystal Displays -Blink and Cursor

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

Arduino Project 001 - LED Blink

Arduino Project 001 - LED Blink

Arduino 电子编程--灯项目及控制,主要使用Arduino编程控制LED灯,实现基本控制Project 1 LED闪烁,基本的应用Project 3和4红绿灯项目项目1 Project...

Arduino Project 016 - L293D Motor Driver IC

Arduino Project 016 - L293D Motor Driver IC

In the previous project, you used a transistor to control the motor. In this project, you are going...

 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...

Arduino Programming Basic - Serial Monitor

Arduino Programming Basic - Serial Monitor

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

Arduino Project 045 - RFID Servo and LED Control System

Arduino Project 045 - RFID Servo and LED Control System

Arduino Programming Basic -- RFID Servo and LED Control System Project 45 RFID Servo...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。