Giter VIP home page Giter VIP logo

led-candle-for-raspberry-pi's Introduction

LED-Candle-for-Raspberry-Pi

Overview

LED candle library for Raspberry Pi. Using this library, you can create LED candles. Combine multiple frequencies to simulate candle fluctuations. With this library, you can change brightness, speed, fluctuation and more. This can be used for illumination as well as candles.

LED Candle

Demo

from Candle import Candle
import time
import RPi.GPIO as GPIO

sleep_ms = lambda ms: time.sleep(ms / 1000.0)

candle = Candle()
candle.create(24)
candle.shuffle(0, 1000)

for times in range(2000):
    candle.refresh()
    sleep_ms(10)

GPIO.cleanup()

Usage

Method

Candle(gpiomode=GPIO.BCM)

gpiomode: How to specify GPIO number

Create an instance.

create(pin, brightness=100, rate=100, ratio=100, pwmfreq=1000)

pin: GPIO pin number
brightness: Brightness level(optional)
rate: Speed ​​of change(optional)
ratio: The magnitude of the fluctuation(optional)
pwmfreq: PWM frequency(optional)

Creates a candle on the specified pin.

reset(pin=None)

pin: GPIO pin number(optional)

Resets the settings of the specified pin. If the argument is omitted, it is executed on all pins.

shuffle(min, max, pin=None)

min: Lower bound of shuffle range
max: Upper limit of shuffle range
pin: GPIO pin number(optional)

Shuffles the start of the waveform to the specified pin between min and max. If pin is omitted, execute on all pins.

pin(beforepin, afterpin, pwmfreq=1000)

beforepin: Pin before change
afterpin: Pin after change
pwmfreq: PWM frequency(optional)

Change the output pin. If pin is omitted, execute on all pins.

brightness(brightness, pin=None)

brightness: Brightness level
pin: GPIO pin number(optional)

Change the brightness. If pin is omitted, execute on all pins.

rate(rate, pin=None)

rate: Speed ​​of change
pin: GPIO pin number(optional)

Change the speed of change. If pin is omitted, execute on all pins.

ratio(ratio, pin=None)

ratio: The magnitude of the fluctuation
pin: GPIO pin number(optional)

Change the size of the fluctuation. If pin is omitted, execute on all pins.

parameter(value, pin=None)

value: Parameter value
pin: GPIO pin number(optional)

Change the value of a parameter. If pin is omitted, execute on all pins.

wave(value, pin=None)

value: Number of sine waves to combine
pin: GPIO pin number(optional)

Change the number of sine waves to combine. If pin is omitted, execute on all pins.

refresh(pin=None)

pin: GPIO pin number(optional)

PWM output to the specified pin. If the argument is omitted, it is executed on all pins.

License

MIT

led-candle-for-raspberry-pi's People

Contributors

naoto64 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.