def test_get_device_serial(serial): from plasma import get_device from plasma.serial import PlasmaSerial device, args = get_device("SERIAL:/dev/ttyACM0") assert device == PlasmaSerial
def test_get_device_ws281x(): from plasma import get_device from plasma.ws281x import PlasmaWS281X device, args = get_device("WS281X:13:WS2812") assert device == PlasmaWS281X
def test_get_device_apa102(): from plasma import get_device from plasma.apa102 import PlasmaAPA102 device, args = get_device("APA102:14:15") assert device == PlasmaAPA102
def test_get_device_raises_valueerror(): from plasma import get_device with pytest.raises(ValueError): get_device("XXXXXX")
def test_get_device_matrix(config_file): from plasma import get_device device, args = get_device(config_file)
import math import time import colorsys import sys import plasma NUM_LIGHTS = 10 FALLOFF = 1.9 SCAN_SPEED = 4 start_time = time.time() if len(sys.argv) > 1: from plasma import get_device Plasma, args = get_device(sys.argv[1]) plasma = Plasma(NUM_LIGHTS, **args) else: from plasma.gpio import PlasmaGPIO plasma = PlasmaGPIO(NUM_LIGHTS, 14, 15) plasma.set_clear_on_exit() print('Num pixels: {}'.format(plasma.get_pixel_count())) while True: delta = (time.time() - start_time) # Offset is a sine wave derived from the time delta # we use this to animate both the hue and larson scan # so they are kept in sync with each other
from plasma import get_device from subprocess import Popen, PIPE """ Färgspel - Lär dig färgerna """ __author__ = "Marcus Kempe" __version__ = "0.1.0" __license__ = "MIT" BRIGHTNESS = 0.4 # Init PLASMA NUM_LIGHTS = 6 Plasma, args = get_device("GPIO:15:14") plasma = Plasma(NUM_LIGHTS, **args) plasma.set_clear_on_exit() # Init sCREEN rgbmatrix5x5 = RGBMatrix5x5() rgbmatrix5x5.set_clear_on_exit() rgbmatrix5x5.set_brightness(BRIGHTNESS) BLUE = (0, 0, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) YELLOW = (255, 255, 0) PURPLE = (127, 0, 255) ORANGE = (255, 128, 0) PINK = (255, 0, 255)