Пример #1
0
active_sequence       = [[0,0,50,2000],1000,[0,0,5,2000],600]  
going_active_sequence = [[0,0,50,0],[0,0,1,200],[0,0,50,200]]
idle_sequence         = [[1,0,1]]
going_idle_sequence   = [[50,0,50,0],[1,0,1,200],[50,0,50,200]]

rgbled = RgbLed.Worker(RGB_PIN_R, RGB_PIN_G, RGB_PIN_B)
rgbled.set_sequence(boot_sequence)
rgbled.start()

ENCODER_PIN_A  = 7
ENCODER_PIN_B  = 8
encoder = RotaryEncoder.Worker(ENCODER_PIN_A, ENCODER_PIN_B)
encoder.start()

SWITCH_PIN = 9
switch = Switch(SWITCH_PIN)
switch_state = switch.get_state()

oled = Oled()
contrast = 0
oled.ssd1306.set_contrast(contrast)

rgbled.set_sequence(startup_sequence)

SPREADSHEET_NAME     = 'TimeClock'
SPREADSHEET_TEMPLATE = 'TimeClock.ods'
ss = Spreadsheet()

if not ss.oauth.has_token():
    user_code = ss.oauth.get_user_code()
    print "Go to %s and enter the code %s" % (ss.oauth.verification_url, user_code)
Пример #2
0
 def __init__(self, pin):
   Switch.__init__(self, pin)
   self.toggleOn = False 
   self.lastState = self.get_state()