Simple tests

Ensure your device works with this simple test.

examples/featherwing_ina219_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
""" Example to print out the voltage and current using the INA219 """
import time
from adafruit_featherwing import ina219_featherwing

INA219 = ina219_featherwing.INA219FeatherWing()

while True:
    print("Bus Voltage:   {} V".format(INA219.bus_voltage))
    print("Shunt Voltage: {} V".format(INA219.shunt_voltage))
    print("Voltage:       {} V".format(INA219.voltage))
    print("Current:       {} mA".format(INA219.current))
    print("")
    time.sleep(0.5)
examples/featherwing_joy_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""This example zeros the joystick, and prints when the joystick moves
   or the buttons are pressed."""
import time
from adafruit_featherwing import joy_featherwing

wing = joy_featherwing.JoyFeatherWing()
last_x = 0
last_y = 0

while True:
    x, y = wing.joystick
    if (abs(x - last_x) > 3) or (abs(y - last_y) > 3):
        last_x = x
        last_y = y
        print(x, y)
    if wing.button_a:
        print("Button A!")
    if wing.button_b:
        print("Button B!")
    if wing.button_x:
        print("Button X!")
    if wing.button_y:
        print("Button Y!")
    if wing.button_select:
        print("Button SELECT!")
    time.sleep(.01)
examples/featherwing_alphanum_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""This example changes the fill, brightness, blink rates,
shows number and text printing, displays a counter
and then shows off the new marquee features."""

from time import sleep
from adafruit_featherwing import alphanum_featherwing

display = alphanum_featherwing.AlphaNumFeatherWing()

#Fill and empty all segments
for count in range(0, 3):
    display.fill(True)
    sleep(0.5)
    display.fill(False)
    sleep(0.5)

#Display a number and text
display.print(1234)
sleep(1)
display.print('Text')

#Change brightness
for brightness in range(0, 16):
    display.brightness = brightness
    sleep(0.1)

#Change blink rate
for blink_rate in range(3, 0, -1):
    display.blink_rate = blink_rate
    sleep(4)
display.blink_rate = 0

#Show a counter using decimals
count = 975.0
while count < 1025:
    count += 1
    display.print(count)
    sleep(0.1)

#Show the Marquee
display.marquee('This is a really long message!!!  ', 0.2)