unicorn

index
/media/pi/PI4_TT/TT3/unicorn.py

This module provides:
an interface to the two Unicorn HAT HD 16x16 displays
used to show the TrainThing signal aspects in place of/
or in addition to, the actual semaphores and
display the state of the Raspberry Pi cooling fan.
 
Functions are provided to simplify, for the TrainThing,
the interface with the UnicornHATHD2 library.

 
Modules

      

 

numpy

threading

unicornhathd2


 
Classes

      

 

  • TT_Display

 
class TT_Display

   

Procedure to display:
Aspect of all TrainThing signals
Status of the Raspberry Pi fan
 

 

Methods defined here:

  • __init__(self, color='BLUE')
  • Initialize settings for the two Unicorn HAT HD.
    By default, sets all expected pixels to BLUE.
    If color is set to anything else aspects are set to
    expected starting values.
  • off(self)
  • Clears the unicorn buffer and display
  • set_fan(self, x, y, r, g, b)
  • We will see
  • set_signal(self, x, y, aspect)
  • Update the displayed aspect of a signal
    at location {x,y}
    arg:
    x, coordinate of the pixel 0-31
    y, coordinate of the pixel 0-15
    aspect, OFF|RED|YELLOW|GREEN

Data and other attributes defined here:

  • GREEN = 3
  • OFF = 0
  • RED = 1
  • YELLOW = 2

 
Functions

      

 

  • sleep(...)
  • sleep(seconds)
     
    Delay execution for a given number of seconds.  The argument may be
    a floating point number for subsecond precision.

 
Data

      

 

path = ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-arm-linux-gnueabihf', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/pi/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/media/pi/PI4_TT']