CODE | LED Fire Effect - Arduino Project 009

RonWang3 years ago (2023-07-18)电子编程 COD5

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.

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));
}

             

Share with Friends:

Related Articles

C05 |   C/C++ Develop Environment

C05 | C/C++ Develop Environment

C语言教程05: C/C++开发环境C 语言编译器可以分为 C 和 C++两大类,其中 C++是 C 的超集,也支持 C 语言编程。事实上,编译器的选择不是最重要的,它们都可以完成基本的 C 语言编译…

CODE | LED Dot Matrix Display Beat Heart - Arduino Project 020

CODE | LED Dot Matrix Display Beat Heart - Arduino Project 020

You’re going to use the same circuit, but with a slight variation in the code to create a multi-fram…

HELLO RUBY Child Coding

HELLO RUBY Child Coding

HELLO RUBY儿童编程大冒险儿童编程思维启蒙读本3-6岁:《Hello Ruby儿童编程大冒险》English Version 英文网站  http://www.hellor…

Electric and Sensor Control System

Electric and Sensor Control System

Since 2022, the founder of Autaba EC deparrment has devoted to the research and development of advan…

Resistor-Electrical Components

Resistor-Electrical Components

A resistor is a passive two-terminal electrical component that implements electrical resistance as a…

Resolving the Need to Enter FTP Credentials for WordPress Themes and Plugins

Resolving the Need to Enter FTP Credentials for WordPress Themes and Plugins

解决安装WordPress主题及插件需要输入FTP问题安装一个WordPress好像挺简单,但是默认主题不喜欢,想更换一个,无奈本地可以更换,但是服务器更换的时候需要设置FTP 。OK,设置呗,好像我…

Post a Comment

Anonymous

Feel free to share your thoughts and opinions here.