Hat

Gets list of devices connected to the hat

class buildhat.Hat(device=None, debug=False)

Allows enumeration of devices which are connected to the hat

get()

Get devices which are connected or disconnected

Returns:

Dictionary of devices

Return type:

dict

get_vin()

Get the voltage present on the input power jack

Returns:

Voltage on the input power jack

Return type:

float

green_led(status=True)

Turn the BuildHAT’s green LED on or off

Parameters:

status – True to turn it on, False to turn it off

orange_led(status=True)

Turn the BuildHAT’s orange LED on or off

Parameters:

status – True to turn it on, False to turn it off

set_leds(color='voltage')

Set the two LEDs on or off on the BuildHAT.

By default the color depends on the input voltage with green being nominal at around 8V (The fastest time the LEDs can be perceptually toggled is around 0.025 seconds)

Parameters:

color – orange, green, both, off, or voltage (default)

Example

"""Example to print devices attached to hat"""

from buildhat import Hat

hat = Hat()
print(hat.get())