framboise-pi / Raspberry-pico_micropython_Candle-effect

Micropython - simple candle effect on multiple GPIO output

Home Page:https://codelibre.fr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Candle effect and micropython

Simple code for a candle effect, applied on 4 outputs, for having 4 asynchronous candles.

** there are 2 values you should change to see the differences with your candle(s) **


pin_led_0_pwm.freq(300)
I'd say from 200 to 1000

time.sleep(.1)
from (.01) to (.1)

how it works

It randoms a 16bits integer (from 0 to 65535), for changing light level on each candles, takes a .sleep and goes on for ever and ever.

Notes

I use 2xLED(s) - old red ones 3mm - by output, (with a R=330Ohms on each output).
A total of 8 red LEDs and PICO displays less than 80mA current consumption.
Can hold candles for days with a battery.
this code could be way more compact by using a for +1 loop

About

Micropython - simple candle effect on multiple GPIO output

https://codelibre.fr

License:GNU Affero General Public License v3.0


Languages

Language:Python 100.0%