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

Arduino Project 009 - LED Fire Effect

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

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://www.donstudio.cn/?id=259

标签: Arduino

相关文章

Arduino Project 019 - LED Dot Matrix Display - Basic Animation

Arduino Project 019 - LED Dot Matrix Display - Basic Animation

So far you have dealt with individual 5mm LEDs. LEDs can also be obtained in a package known as a do...

Arduino Project 044 - Simple RFID Reader

Arduino Project 044 - Simple RFID Reader

Arduino Programming Basic -- Making an RFID ReaderProject 44 Simple RFID ReaderWiring Diagram Betwee...

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