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

Arduino Project 009 - LED Fire Effect

RonWang10个月前 (07-16)电子编程361

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 037 - 18B20 Temperature Sensor

Arduino Project 037 - 18B20 Temperature Sensor

The DS18B20 Temperature Sensor is a digital temperature sensor capable of measuring temperatures wit...

Arduino Programming Basic - Serial Monitor

Arduino Programming Basic - Serial Monitor

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

Arduino Project 024 -  LCD Temperature Display

Arduino Project 024 - LCD Temperature Display

This project is a simple demonstration of using an LCD to present useful information to the user—in...

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 007 - Pulsating Lamp

Arduino Project 007 - Pulsating Lamp

You are now going try a more advanced method of controlling LEDs. So far, you have simply turned the...

Arduino Project 010 - Serial Controlled Mood Lamp

Arduino Project 010 - Serial Controlled Mood Lamp

For Project 10, you will revisit the circuit from Project 8 — RGB Mood Lamp, but you’ll now delve in...