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

Arduino Project 009 - LED Fire Effect

RonWang11个月前 (07-16)电子编程408

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 015 - Simple Motor Control

Arduino Project 015 - Simple Motor Control

First, you’re going to simply control the speed of a DC motor in one direction, using a power transi...

Arduino Project 028A - Basic Stepper Control (Bipolar)

Arduino Project 028A - Basic Stepper Control (Bipolar)

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

Arduino Project 035 - Keypad 4X4 or 4X3

Arduino Project 035 - Keypad 4X4 or 4X3

Most of the time we are used key, button, or switch to get input value in our projects. When we inte...

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