Ejemplo n.º 1
0
def extra_demo():
    # One cycle of red, green and blue each
    print('One strandtest of red, green and blue each')
    MY_CYCLE = colorschemes.StrandTest(num_leds=NUM_LEDS, pause_value=0,
                                       num_steps_per_cycle=NUM_LEDS, num_cycles=3, order="rbg",
                                       global_brightness=10)
    MY_CYCLE.start()

    # Two slow trips through the rainbow
    print('Two slow trips through the rainbow')
    MY_CYCLE = colorschemes.Rainbow(num_leds=NUM_LEDS, pause_value=0,
                                    num_steps_per_cycle=255, num_cycles=2, order="rbg",
                                    global_brightness=10)
    MY_CYCLE.start()

    # Five quick trips through the rainbow
    print('Five quick trips through the rainbow')
    MY_CYCLE = colorschemes.TheaterChase(num_leds=NUM_LEDS, pause_value=0.04,
                                         num_steps_per_cycle=35, num_cycles=4, order="rbg",
                                         global_brightness=5)
    MY_CYCLE = colorschemes.TheaterChase(num_leds=NUM_LEDS, pause_value=0.04,
                                         num_steps_per_cycle=35, num_cycles=4, order="rbg",
                                         global_brightness=100)
    MY_CYCLE.start()

    print('Finished the test')
Ejemplo n.º 2
0
 def rainbow(self, brightness, duration_time):
     """colorful rainbow cycling through all leds"""
     if self.stop_led:
         logger.debug('skipping led rainbow, since button was pressed')
         return
     logger.debug('running led rainbow with brightness {}/10 for {}sec'.format(brightness, duration_time))
     self.leds_active = True
     clock = 0
     start = time.time()
     while clock < duration_time and self.stop_led is False:
         rainbow = colorschemes.Rainbow(numLEDs=self.number_of_leds, pauseValue=0.02, numStepsPerCycle=255,
                                        numCycles=1, globalBrightness=brightness)
         rainbow.start()
         clock = time.time() - start
     self.leds_active = False
Ejemplo n.º 3
0
        MY_CYCLE.start()

    if 2 in args.patterns:
        # One cycle of red, green and blue each
        print('One strandtest of red, green and blue each')
        MY_CYCLE = colorschemes.StrandTest(
            num_steps_per_cycle=options['num_led'], num_cycles=3, **options)
        MY_CYCLE.start()

    if 3 in args.patterns:
        # One slow trip through the rainbow
        print('One slow trip through the rainbow')
        MY_CYCLE = ColorCycleTemplate(num_steps_per_cycle=255,
                                      num_cycles=1,
                                      **options)
        rainbow = colorschemes.Rainbow(**options)
        MY_CYCLE.append_updater(rainbow.update)
        MY_CYCLE.append_updater(colorschemes.create_swipe(args.num_led - 1, 0))
        MY_CYCLE.start()

    if 4 in args.patterns:
        # Five quick trips through the rainbow
        print('Five quick trips through the rainbow')
        MY_CYCLE = colorschemes.TheaterChase(pause_value=0.04,
                                             num_steps_per_cycle=35,
                                             num_cycles=5,
                                             **options)
        MY_CYCLE.start()

    if 5 in args.patterns:
        print('A Larson Scanner, a fire, and red alert')
Ejemplo n.º 4
0
import sys
import os
sys.path.append(os.path.abspath("/home/pi/APA102_Pi"))
import colorschemes


numLEDs = 9

print('Rainbow Brightness 5of10')
myCycle = colorschemes.Rainbow(numLEDs=numLEDs, pauseValue=0.05, numStepsPerCycle = 255, numCycles = 2, globalBrightness=5)
myCycle.start()

print('Just plain white for 3 seconds')
myCycle = colorschemes.Solid(numLEDs=numLEDs, pauseValue=3, numStepsPerCycle = 1, numCycles = 1)
myCycle.start()




Ejemplo n.º 5
0
"""Sample script to run a few colour tests on a Pimoroni Blinkt!."""
import colorschemes

NUM_LED = 8
MOSI = 23  # Hardware SPI uses BCM 10 & 11. Change these values for bit bang mode
SCLK = 24  # e.g. MOSI = 23, SCLK = 24 for Pimoroni Phat Beat or Blinkt!

# Paint white, red, green and blue once for one second
print('White, red, green, blue on all LEDs')
MY_CYCLE = colorschemes.Solid(num_led=NUM_LED,
                              pause_value=1,
                              order='rgb',
                              num_steps_per_cycle=4,
                              num_cycles=1,
                              mosi=MOSI,
                              sclk=SCLK)
MY_CYCLE.start()

# Five trips through the rainbow
print('Five trips through the rainbow')
MY_CYCLE = colorschemes.Rainbow(num_led=NUM_LED,
                                pause_value=0,
                                order='rgb',
                                num_steps_per_cycle=255,
                                num_cycles=5,
                                mosi=MOSI,
                                sclk=SCLK)
MY_CYCLE.start()

print('Finished the test')
Ejemplo n.º 6
0
import datetime

NUM_LED = 200
today = datetime.datetime.now()

# One Cycle with one step and a pause of three seconds. Hence three seconds of white light
print('Three Seconds of white light')
MY_CYCLE = colorschemes.Solid(num_led=NUM_LED,
                              pause_value=3,
                              num_steps_per_cycle=1,
                              num_cycles=1)
MY_CYCLE.start()

# One slow trip through the rainbow
print('One slow trip through the rainbow')
MY_CYCLE = colorschemes.Rainbow(num_led=NUM_LED,
                                pause_value=0,
                                num_steps_per_cycle=255,
                                num_cycles=1)
MY_CYCLE.start()

# Five quick trips through the rainbow
print('Five quick trips through the rainbow')
MY_CYCLE = colorschemes.TheaterChase(num_led=NUM_LED,
                                     pause_value=0.04,
                                     num_steps_per_cycle=35,
                                     num_cycles=5)
MY_CYCLE.start()

print('Finished the test')
print('current time:', today.ctime())
Ejemplo n.º 7
0
MY_CYCLE.start()

# One cycle of red, green and blue each
print('One strandtest of red, green and blue each')
MY_CYCLE = colorschemes.StrandTest(num_led=NUM_LED,
                                   pause_value=0,
                                   num_steps_per_cycle=NUM_LED,
                                   num_cycles=3,
                                   global_brightness=10)
MY_CYCLE.start()

# Two slow trips through the rainbow
print('Two slow trips through the rainbow')
MY_CYCLE = colorschemes.Rainbow(num_led=NUM_LED,
                                pause_value=0,
                                num_steps_per_cycle=255,
                                num_cycles=2,
                                global_brightness=10)
MY_CYCLE.start()

# Five quick trips through the rainbow
print('Five quick trips through the rainbow')
MY_CYCLE = colorschemes.TheaterChase(num_led=NUM_LED,
                                     pause_value=0.04,
                                     num_steps_per_cycle=35,
                                     num_cycles=5,
                                     global_brightness=10)
MY_CYCLE.start()

print('Finished the test')
Ejemplo n.º 8
0
import colorschemes

numLEDs = 144
# One Cycle with one step and a pause of one second. Hence one second of white light
print('One Second of white light')
myCycle = colorschemes.Solid(pauseValue=1, numStepsPerCycle = 1, numCycles = 1)
myCycle.start()
# Go twice around the clock
print('Go twice around the clock')
myCycle = colorschemes.RoundAndRound(pauseValue=0, numStepsPerCycle = numLEDs, numCycles = 2)
myCycle.start()
# One cycle of red, green and blue each
print('One strandtest of red, green and blue each')
myCycle = colorschemes.StrandTest(pauseValue=0, numStepsPerCycle = numLEDs, numCycles = 3, globalBrightness=10)
myCycle.start()
# Two slow trips through the rainbow
print('Two slow trips through the rainbow')
myCycle = colorschemes.Rainbow(pauseValue=0, numStepsPerCycle = 255, numCycles = 2, globalBrightness=10)
myCycle.start()
# Five quick trips through the rainbow
print('Five quick trips through the rainbow')
myCycle = colorschemes.TheaterChase(pauseValue=0.04, numStepsPerCycle = 35, numCycles = 5, globalBrightness=10)
myCycle.start()
print('Finished the test')