Arduino Project 009 - LED Fire Effect
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所有,欢迎分享本文,转载请保留出处!