Ejemplo n.º 1
0
 def on(self):
     self._lock.acquire()
     self.lcd = Adafruit_CharLCDPlate()
     self.lcd.begin(WIDTH, 2)
     self.lcd.clear()
     self.lcd.backlight(self._color)
     self._lock.release()
Ejemplo n.º 2
0
        self.position = self.position + 1

        # We add five extra spaces between each complete text scroll.
        if self.position > len(self.text) + 4:
            self.position = 0

        return scrolledText

    def setNewText(self, newText):
        self.text = newText
        self.position = 0


# Initialize the LCD plate.  Should auto-detect correct I2C bus.  If not,
# pass '0' for early 256 MB Model B boards or '1' for all later versions
lcd = Adafruit_CharLCDPlate()
lcd.begin(16, 2)
lcd.clear()
lcd.backlight(lcd.ON)
tmr = None
# Poll buttons
btn = (lcd.LEFT, lcd.UP, lcd.DOWN, lcd.RIGHT, lcd.SELECT)

lastArtistSong = ''
scroller = TextScroller('', 16)

while True:

    # Get current status and playtime
    process = subprocess.Popen('mpc', shell=True, stdout=subprocess.PIPE)
    status = process.communicate()[0]