Skip to content

Instantly share code, notes, and snippets.

@fire-eggs
Created February 29, 2016 19:52
Show Gist options
  • Save fire-eggs/e2c7804651f244363217 to your computer and use it in GitHub Desktop.
Save fire-eggs/e2c7804651f244363217 to your computer and use it in GitHub Desktop.
A Python script to show off a "hidden" feature of the Pimoroni Display-o-Tron HAT. Shows how to use double-height text in the LCD.
#!/usr/bin/env python
print("""
This example shows you a feature of the LCD hardware used
by the Dot HAT. You should see double-height text!
Press CTRL+C to exit.
""")
import dothat.backlight as backlight
import dothat.lcd as lcd
import atexit
import time
def tidyup():
backlight.off()
lcd.clear()
backlight.graph_off()
# This line gives us access to features of the underlying
# LCD which are not exposed in the dothat.lcd code.
baselcd = lcd.lcd
lcd.clear()
backlight.graph_off()
backlight.rgb(92,172,238)
#lcd.set_cursor_position(0,1) #uncomment for doubling the second line
lcd.write("**ORANGE ALERT**")
atexit.register(tidyup)
while True:
# (1,1) doubles the first line; (1,2) doubles the second
baselcd.double_height(1,1)
backlight.rgb(255,140,0)
backlight.set_graph(100)
time.sleep(0.45)
# turn off double-height
baselcd.double_height(0)
backlight.rgb(92,172,238)
backlight.set_graph(0)
time.sleep(0.15)
# feel free to play an appropriate alarm sound on your Pi!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment