Example #1
0
"""
Ein kleines Zug-Programm für die kleine LED-Stripe-Library.
Wenn alles glatt läuft, müsste ein roter Zug in Endlosschleife hin- und herfahren.

© Elias Gürlich, 2016
"""

from led_stripe_py import LED_Stripe, LED_Stripe_Datagram, LED  # Alles aus der LED-Stripe-Lib importieren
import math  # Importiere natives Math-Modul
import time  # Importiere natives Time-Modul
import random

HOST_NAME = "172.22.99.206"
PORT = 2342

led_stripe = LED_Stripe(HOST_NAME,
                        PORT)  # Erzeuge Lichterkette mit diesem Host und Port

leds = []

for i in range(0, 20):
    led = LED(0x00, 0x00, 0xff)
    leds.append(led)

for i in range(0, 206):
    led = LED(0x00, 0x00, 0x00)
    leds.append(led)

datagram = LED_Stripe_Datagram(priority=0xff, command=0x00, leds=leds)

happy_colors = [[0xff, 0x00, 0x00], [0x00, 0xff, 0x00], [0x00, 0x00, 0xff],
                [0xff, 0xff, 0x00]]