Introduction

LED candles are very common these days.  It’s easy to see the attraction — there’s no fire danger and they never need to be replaced (just batteries).  But there’s such a wide variation in price and quality that it’s hard to know what to purchase.  Some store-bought candles flicker very realistically, others just seem to blink.  Some use plain white LEDs, some look like real flames.

In this lesson, we’ll show you how to use sound sensor, light sensor and LED with OSOYOO UNO to build an electronic candle.

Connection

You connect the components as shown in the diagram below.

led模块接到扩展板D9

光敏传感器接到扩展板A0

声音传感器接到扩展板A1

需要重新画连线图!!!!

CODE PROGRAM

After above operations are completed, connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.Open the Graphical Programming software Mixly and follow the next operations:

Click Save aftogramming is done, then upload the code to the UNO board.

Running Result

When the brightness is dark, the candle “lights up”, the flame flashes, and the sound of blowing the candle, the candle extinguishes.

添加实验结果图