Welcome¶
This documentation will guide you through the methods available in the Four Letter pHAT python library.
Four Letter pHAT is a Raspberry Pi add-on with four star displays.
- More information - https://shop.pimoroni.com/products/four-letter-phat
- GPIO Pinout - http://pinout.xyz/pinout/four_letter_phat
- Get the code - https://github.com/pimoroni/four-letter-phat
- Get help - http://forums.pimoroni.com/c/support
At A Glance¶
Alphanumeric 14 segment LED backpack display.
fourletterphat.begin()¶
fourletterphat.clear()¶
fourletterphat.print_float(value, decimal_digits=2, justify_right=True)¶
fourletterphat.print_hex(value, justify_right=True)¶
fourletterphat.print_number_str(value, justify_right=True)¶
fourletterphat.print_str(value, justify_right=True)¶
fourletterphat.set_blink(frequency)¶
fourletterphat.set_brightness(brightness)¶
fourletterphat.set_decimal(pos, decimal)¶
fourletterphat.set_digit(pos, digit, decimal=False)¶
fourletterphat.set_digit_raw(pos, bitmask)¶
fourletterphat.set_led(led, value)¶
fourletterphat.show()¶
fourletterphat.write_display()¶
Set A Single Digit¶
-
fourletterphat.set_digit(pos, digit, decimal=False) Set digit at position to provided value.
Position should be a value of 0 to 3 with 0 being the left most digit on the display. Digit should be any ASCII value 32-127 (printable ASCII).
-
fourletterphat.set_digit_raw(pos, bitmask) Set digit at position to raw bitmask value.
Position should be a value of 0 to 3 with 0 being the left most digit on the display.
Set A Decimal Point¶
-
fourletterphat.set_decimal(pos, decimal) Turn decimal point on or off at provided position.
Position should be a value 0 to 3 with 0 being the left most digit on the display. Decimal should be True to turn on the decimal point and False to turn it off.
Print A Float¶
-
fourletterphat.print_float(value, decimal_digits=2, justify_right=True) Print a numeric value to the display.
If value is negative it will be printed with a leading minus sign. Decimal digits is the desired number of digits after the decimal point.
Print Hexadecimal¶
-
fourletterphat.print_hex(value, justify_right=True) Print a numeric value in hexadecimal.
Value should be from 0 to FFFF.
Print A String¶
-
fourletterphat.print_str(value, justify_right=True) Print a 4 character long string of values to the display.
Characters in the string should be any ASCII value 32 to 127 (printable ASCII).
Print A Number String¶
-
fourletterphat.print_number_str(value, justify_right=True) Print a 4 character long string of numeric values to the display.
This function is similar to print_str but will interpret periods not as characters but as decimal points associated with the previous character.
Blink The Display¶
-
fourletterphat.set_blink(frequency) Blink display at specified frequency.
- Note that frequency must be a value allowed by the HT16K33, specifically one of:
- HT16K33_BLINK_OFF,
- HT16K33_BLINK_2HZ,
- HT16K33_BLINK_1HZ, or
- HT16K33_BLINK_HALFHZ.
Set Brightness¶
-
fourletterphat.set_brightness(brightness) Set brightness of entire display to specified value.
Supports 16 levels, from 0 to 15.
Clear The Display¶
-
fourletterphat.clear() Clear contents of display buffer.
Update The Display¶
Once you’ve made your changes, you’ll need to update the display.
-
fourletterphat.show() Display buffer on display.