def booptoggle(): # Draw the text 'BP and part of an arrow' dcfurs.clear() dcfurs.set_row(0, 0x02066) dcfurs.set_row(1, 0x020aa) dcfurs.set_row(2, 0x02066) dcfurs.set_row(3, 0x0202a) dcfurs.set_row(4, 0x02026) # Toggle the boop selection. if settings.boopselect: settings.boopselect = 0 badge.boop = dcfurs.boop(settings.boopselect) dcfurs.set_pixel(12, 1, 0xff) dcfurs.set_pixel(14, 1, 0xff) dcfurs.set_pixel(11, 2, 0xff) dcfurs.set_pixel(15, 2, 0xff) else: settings.boopselect = 1 badge.boop = dcfurs.boop(settings.boopselect) dcfurs.set_pixel(12, 3, 0xff) dcfurs.set_pixel(14, 3, 0xff) dcfurs.set_pixel(11, 2, 0xff) dcfurs.set_pixel(15, 2, 0xff)
## Returns 1 on a rising edge, or 0 on no change. def event(self): if not self.prev: self.prev = self.pin.value() return self.prev else: self.prev = self.pin.value() return 0 right = switch(Pin('SW1', Pin.IN)) left = switch(Pin('SW2', Pin.IN)) ##----------------------------------------------- ## Capacative Touch Controller ##----------------------------------------------- boop = dcfurs.boop() tmr = Timer(2, freq=100) tmr.callback(lambda t: boop.start()) ##----------------------------------------------- ## Motion Detection / Accelerometer ##----------------------------------------------- class dummy: def x(self): return 0 def y(self): return 0 def z(self): return 0
def event(self): if not self.prev: self.prev = self.pin.value() return self.prev else: self.prev = self.pin.value() return 0 right = switch(Pin('SW1', Pin.IN)) left = switch(Pin('SW2', Pin.IN)) ##----------------------------------------------- ## Capacative Touch Controller ##----------------------------------------------- boop = dcfurs.boop(settings.boopselect) tmr = Timer(2, freq=100) tmr.callback(lambda t: boop.start()) ##----------------------------------------------- ## Motion Detection / Accelerometer ##----------------------------------------------- class dummy: def x(self): return 0 def y(self): return 0 def z(self):