Exemple #1
0
 def white_blinking(self, duration_time):
     """most bright white blinking, finally you should wake up"""
     if self.stop_led:
         logger.debug('skipping led white blinking, since button was pressed')
         return
     logger.debug('running led white blinking')
     self.leds_active = True
     clock = 0
     start = time.time()
     while clock < duration_time and self.stop_led is False:
         blinking = colorschemes.Solid(numLEDs=self.number_of_leds, pauseValue=0.05, numStepsPerCycle=1,
                                       numCycles=1)
         blinking.start()
         time.sleep(0.05)
         clock = time.time() - start
     self.leds_active = False
Exemple #2
0
                        type=int,
                        default=range(100),
                        nargs='+',
                        help='Controls which test patterns run.')
    args = parser.parse_args()

    options = {
        'num_led': args.num_led,
        'mosi': args.mosi,
        'sclk': args.sclk,
    }

    if 0 in args.patterns:
        # One Cycle with one step and a pause of theee seconds. Hence three seconds of white light
        print('Three Seconds of white light')
        MY_CYCLE = colorschemes.Solid(duration_s=3, **options)
        MY_CYCLE.start()

    if 1 in args.patterns:
        # Go twice around the clock
        print('Go twice around the clock')
        MY_CYCLE = colorschemes.RoundAndRound(
            num_steps_per_cycle=options['num_led'], num_cycles=2, **options)
        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()
Exemple #3
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()




#!/usr/bin/env python3
"""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')
Exemple #5
0
while True:

	today7am = now.replace(hour=7, minute=0, second=0, microsecond=0)
	today7pm = now.replace(hour=19, minute=0, second=0, microsecond=0)
	now = datetime.datetime.now()

	if (now < today7am) and (CRYO == 1):
		print('Early morning')
		MY_CYCLE = colorschemes.Solid2(num_led=NUM_LED, pause_value=4,
							num_steps_per_cycle=1, num_cycles=1)
		CRYO = 2
		MY_CYCLE.start()

	if (now > today7am) and (now < today7pm) and (CRYO == 2):
		print('Daytime')
		MY_CYCLE = colorschemes.Solid(num_led=NUM_LED, pause_value=4,
                            num_steps_per_cycle=1, num_cycles=1)
		CRYO = 3
		MY_CYCLE.start()
		

	if (now > today7pm) and (CRYO == 3):
		print('Nighttime')
		MY_CYCLE = colorschemes.Solid2(num_led=NUM_LED, pause_value=4,
							num_steps_per_cycle=1, num_cycles=1)
		CRYO = 1
		MY_CYCLE.start()
		
	print(CRYO)
	print(today7am)
	print(today7pm)
	print(now)
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')