Exemple #1
0
    def onButtonPressed(self, node, button):
        global lamp,lamps,colormode,bwstate,refreshlcdevent
        if button == 0:
            hid.clear(7-lamp)
            lamp = (lamp+1) % len(lamps)
            refreshlcd()
#            if lamp < len(lamps):
#                hid.lcd(0,0,lamps[lamp])
        elif button == 1:
            colormode = (colormode + 1) % 3
            refreshlcd()
#            if mode == 1:
#                mode = 2
#                hid.lcd(0,1,'Off   Mode Group')
#            elif mode == 2:
#                mode = 1
#                hid.lcd(0,1,'White Mode Group')
        elif button == 6:
            a = uberbus.moodlamp.Moodlamp(lamps[lamp],True)
            print "connecting to", lamps[lamp]
            a.connect()
            if bwstate:
                #a.setcolor(255,255,255)
                a.timedfade(0xff,0xff,0xff,.5)
            else:
                #a.setcolor(0,0,0)
                a.timedfade(0x00,0x00,0x00,.5)
            bwstate = not bwstate
            refreshlcd()
Exemple #2
0
 def onButtonPressed(self, node, button):
     global lamp, lamps
     if button == 0:
         hid.clear(7-lamp)
         lamp += 1
         if lamp == len(lamps):
             lamp = 0
         if lamp < 3:
             hid.set(7-lamp)
         a = uberbus.moodlamp.Moodlamp(lamps[lamp],True)
         print "connecting to", lamps[lamp]
         a.connect()
         a.flash(64,0,0,.01)  
     elif button == 6:
         a = uberbus.moodlamp.Moodlamp(lamps[lamp],True)
         print "connecting to", lamps[lamp]
         a.connect()
         a.setcolor(255,255,255)
Exemple #3
0
 def onButtonPressed(self, node, button):
     global lamp, lamps, mode
     if button == 0:
         hid.clear(7-lamp)
         lamp += 1
         if lamp == len(lamps):
             lamp = 0
         hid.lcd(0,0,lamps[lamp])
     elif button == 1:
         if mode == 1:
             mode = 2
             hid.lcd(0,1,'Off   Mode Group')
         elif mode == 2:
             mode = 1
             hid.lcd(0,1,'White Mode Group')
     elif button == 6:
         a = uberbus.moodlamp.Moodlamp(lamps[lamp],True)
         print "connecting to", lamps[lamp]
         a.connect()
         if mode == 1:
             a.setcolor(255,255,255)
         elif mode == 2:
             a.setcolor(0,0,0)