pyglow.pulse(10, val, speedval) pyglow.pulse(11, val, speedval) pyglow.pulse(12, val, speedval) pyglow.pulse(13, val, speedval) pyglow.pulse(14, val, speedval) pyglow.pulse(15, val, speedval) pyglow.pulse(16, val, speedval) pyglow.pulse(17, val, speedval) pyglow.pulse(18, val, speedval) arm_choice = input("Pick a number between 1 and 3: ") if arm_choice < 0 or arm_choice > 3: sys.exit() pyglow.pulse_arm(arm_choice, val, speedval) pulse_choice = input("Pulse all? 1/0: ") if pulse_choice == 1: pyglow.pulse_all(val, speedval) else : print("Oh, okay then. :(") pulse_pattern = input("What pattern do you want? Choice between 1-5: ") if pulse_pattern == 1: pyglow.pulse_all(val, speedval) elif pulse_pattern == 2: pyglow.pulse_arm(1, val, speedval) elif pulse_pattern == 3: pyglow.pulse(1, val, speedval)
## ## PyGlow ## ## python module to control Pimoronis PiGlow (http://shop.pimoroni.com/products/piglow) ## ## * pulsetest.py - test the pulsing light feature ## from pyglow import PyGlow pyglow = PyGlow() val = input("Maximum Brightness: ") speedval = input("Speed (Try 500 as a default): ") pyglow.all(0) print("Pulsing 1 Light") pyglow.pulse(1, val, speedval) print("Pulsing Arms") pyglow.pulse_arm(1, val, speedval) pyglow.pulse_arm(2, val, speedval) pyglow.pulse_arm(3, val, speedval) print("Pulsing All") pyglow.pulse_all(val, speedval)
if temp_to_brightness1 > 254: temp_to_brightness1 = 254 temp_to_color1 = int(round(temp / 100 * 6)) if temp_to_color1 > 6: temp_to_color1 = 6 wind_to_wait1 = 3 / wind wind_to_speed = int(wind * 40) print(city1) print('temp %f' % temp) print('wind %f' % wind) for x in range(100): for i in range(1): outandin(temp_to_color, temp_to_brightness, wind_to_wait) outandout(temp_to_color, temp_to_brightness, wind_to_wait) for i in range(1): inandout(temp_to_color1, temp_to_brightness1, wind_to_wait1) inandin(temp_to_color1, temp_to_brightness1, wind_to_wait1) print('loop %s' % x) # traffic for i in range(3): pyglow.pulse_arm((i+1),75,200) print('loop complete, calling for more data') except KeyboardInterrupt: # turn off all leds pyglow.all(0)
temp_to_brightness1 = int(temp / 100 * 254) if temp_to_brightness1 > 254: temp_to_brightness1 = 254 temp_to_color1 = int(round(temp / 100 * 6)) if temp_to_color1 > 6: temp_to_color1 = 6 wind_to_wait1 = 3 / wind wind_to_speed = int(wind * 40) print(city1) print('temp %f' % temp) print('wind %f' % wind) for x in range(100): for i in range(1): outandin(temp_to_color, temp_to_brightness, wind_to_wait) outandout(temp_to_color, temp_to_brightness, wind_to_wait) for i in range(1): inandout(temp_to_color1, temp_to_brightness1, wind_to_wait1) inandin(temp_to_color1, temp_to_brightness1, wind_to_wait1) print('loop %s' % x) # traffic for i in range(3): pyglow.pulse_arm((i + 1), 75, 200) print('loop complete, calling for more data') except KeyboardInterrupt: # turn off all leds pyglow.all(0)