adafruit_featherwing.ina219_featherwing

Helper for using the INA219 FeatherWing.

  • Author(s): Kattni Rembor
class adafruit_featherwing.ina219_featherwing.INA219FeatherWing[source]

Class representing an Adafruit INA219 FeatherWing.

Automatically uses the feather’s I2C bus.

bus_voltage

Bus voltage returns volts.

INA219 Featherwing

This example prints the bus voltage with the appropriate units.

from adafruit_featherwing import ina219_featherwing
import time

ina219 = ina219_featherwing.INA219FeatherWing()

while True:
    print("Bus Voltage: {} V".format(ina219.bus_voltage))
    time.sleep(0.5)
current

Current returns mA.

INA219 Featherwing

This example prints the current with the appropriate units.

from adafruit_featherwing import ina219_featherwing
import time

ina219 = ina219_featherwing.INA219FeatherWing()

while True:
    print("Current: {} mA".format(ina219.current))
    time.sleep(0.5)
shunt_voltage

Shunt voltage returns volts.

INA219 Featherwing

This example prints the shunt voltage with the appropriate units.

from adafruit_featherwing import ina219_featherwing
import time

ina219 = ina219_featherwing.INA219FeatherWing()

while True:
    print("Shunt Voltage: {} V".format(ina219.shunt_voltage))
    time.sleep(0.5)
voltage

Voltage, known as load voltage, is bus voltage plus shunt voltage. Returns volts.

INA219 Featherwing

This example prints the voltage with the appropriate units.

from adafruit_featherwing import ina219_featherwing
import time

ina219 = ina219_featherwing.INA219FeatherWing()

while True:
    print("Voltage: {} V".format(ina219.voltage))
    time.sleep(0.5)

adafruit_featherwing.joy_featherwing

Helper for using the Joy FeatherWing.

  • Author(s): Kattni Rembor
class adafruit_featherwing.joy_featherwing.JoyFeatherWing[source]

Class representing an Adafruit Joy FeatherWing.

Automatically uses the feather’s I2C bus.

button_a

Joy featherwing button A.

Joy FeatherWing Button A

This example prints when button A is pressed.

from adafruit_featherwing import joy_featherwing
import time

wing = joy_featherwing.JoyFeatherWing()

while True:
    if wing.button_a:
    print("Button A pressed!")
button_b

Joy featherwing button B.

Joy FeatherWing Button B

This example prints when button B is pressed.

from adafruit_featherwing import joy_featherwing
import time

wing = joy_featherwing.JoyFeatherWing()

while True:
    if wing.button_b:
    print("Button B pressed!")
button_select

Joy featherwing button SELECT.

Joy FeatherWing Button SELECT

This example prints when button SELECT is pressed.

from adafruit_featherwing import joy_featherwing
import time

wing = joy_featherwing.JoyFeatherWing()

while True:
    if wing.button_select:
    print("Button SELECT pressed!")
button_x

Joy featherwing button X.

Joy FeatherWing Button X

This example prints when button X is pressed.

from adafruit_featherwing import joy_featherwing
import time

wing = joy_featherwing.JoyFeatherWing()

while True:
    if wing.button_x:
    print("Button X pressed!")
button_y

Joy featherwing button Y.

Joy FeatherWing Button Y

This example prints when button Y is pressed.

from adafruit_featherwing import joy_featherwing
import time

wing = joy_featherwing.JoyFeatherWing()

while True:
    if wing.button_y:
    print("Button Y pressed!")
joystick

Joy FeatherWing joystick.

Joy FeatherWing Joystick

This example zeros the joystick, and prints the coordinates of joystick when it is moved.

from adafruit_featherwing import joy_featherwing
import time

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

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)
    time.sleep(0.01)
joystick_offset

Offset used to correctly report (0, 0) when the joystick is centered.

Joy FeatherWing Joystick

Provide a tuple of (x, y) to set your joystick center to (0, 0). The offset you provide is subtracted from the current reading. For example, if your joystick reads as (-4, 0), you would enter (-4, 0) as the offset. The code will subtract -4 from -4, and 0 from 0, returning (0, 0).

This example supplies an offset for zeroing, and prints the coordinates of the joystick when it is moved.

from adafruit_featherwing import joy_featherwing
import time

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

while True:
    wing.joystick_offset = (-4, 0)
    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)
    time.sleep(0.01)
zero_joystick()[source]

Zeros the joystick by using current reading as (0, 0). Note: You must not be touching the joystick at the time of zeroing for it to be accurate.

Joy FeatherWing Joystick

This example zeros the joystick, and prints the coordinates of joystick when it is moved.

from adafruit_featherwing import joy_featherwing
import time

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

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)
    time.sleep(0.01)

adafruit_featherwing.alphanum_featherwing

Helper for using the 14-Segment AlphaNumeric FeatherWing.

  • Author(s): Melissa LeBlanc-Williams
class adafruit_featherwing.alphanum_featherwing.AlphaNumFeatherWing(address=112)[source]

Class representing an Adafruit 14-segment AlphaNumeric FeatherWing.

Automatically uses the feather’s I2C bus.

Blink Rate returns the current rate that the text blinks. 0 = Off 1-3 = Successively slower blink rates

This example changes the blink rate and prints out the current setting

from time import sleep
from adafruit_featherwing import alphanum_featherwing

display = alphanum_featherwing.AlphaNumFeatherWing()
display.print('Text')

for blink_rate in range(3, -1, -1):
    display.blink_rate = blink_rate
    print("Current Blink Rate is {}".format(display.blink_rate))
    sleep(4)
brightness

Brightness returns the current display brightness. 0-15 = Dimmest to Brightest Setting

This example changes the brightness and prints out the current setting

from time import sleep
from adafruit_featherwing import alphanum_featherwing

display = alphanum_featherwing.AlphaNumFeatherWing()
display.print('Text')

for brightness in range(0, 16):
    display.brightness = brightness
    print("Current Brightness is {}".format(display.brightness))
    sleep(0.2)
fill(fill)[source]

Change all Segments on or off :param bool fill: True turns all segments on, False turns all segments off

This example alternates between all filled and all empty segments.

from time import sleep
from adafruit_featherwing import alphanum_featherwing

display = alphanum_featherwing.AlphaNumFeatherWing()

while True:
    display.fill(True)
    sleep(0.5)
    display.fill(False)
    sleep(0.5)
marquee(text, delay=0.25, loop=True)[source]

Automatically scroll the text at the specified delay between characters

Parameters:
  • text (str) – The text to display
  • delay (float) – (optional) The delay in seconds to pause before scrolling to the next character (default=0.25)
  • loop (bool) – (optional) Whether to endlessly loop the text (default=True)
from adafruit_featherwing import alphanum_featherwing

display = alphanum_featherwing.AlphaNumFeatherWing()
display.marquee('This is some really long text  ')
print(value)[source]

Print a number or text to the display

Parameters:value (str or int or float) – The text or number to display
from adafruit_featherwing import alphanum_featherwing

display = alphanum_featherwing.AlphaNumFeatherWing()
display.print(1234)

adafruit_featherwing.dotstar_featherwing

Helper for using the DotStar FeatherWing.

  • Author(s): Melissa LeBlanc-Williams
class adafruit_featherwing.dotstar_featherwing.DotStarFeatherWing(clock=<sphinx.ext.autodoc.importer._MockObject object>, data=<sphinx.ext.autodoc.importer._MockObject object>, brightness=0.2)[source]

Class representing a DotStar FeatherWing.

The feather uses pins D13 and D11

adafruit_featherwing.neopixel_featherwing

Helper for using the NeoPixel FeatherWing.

  • Author(s): Melissa LeBlanc-Williams
class adafruit_featherwing.neopixel_featherwing.NeoPixelFeatherWing(pixel_pin=<sphinx.ext.autodoc.importer._MockObject object>, brightness=0.1)[source]

Class representing a NeoPixel FeatherWing.

The feather uses pins D6 by default

shift_down(rotate=False)[source]

Shift all pixels down.

Parameters:rotate – (Optional) Rotate the shifted pixels to top (default=False)

This example shifts 2 pixels down

import time
from adafruit_featherwing import neopixel_featherwing

neopixel = neopixel_featherwing.NeoPixelFeatherWing()

# Draw Red and Green Pixels
neopixel[4, 1] = (255, 0, 0)
neopixel[5, 1] = (0, 255, 0)

# Rotate it off the screen
for i in range(0, neopixel.rows - 1):
    neopixel.shift_down(True)
    time.sleep(.1)

time.sleep(1)
# Shift it off the screen
for i in range(0, neopixel.rows - 1):
    neopixel.shift_down()
    time.sleep(.1)
shift_up(rotate=False)[source]

Shift all pixels up

Parameters:rotate – (Optional) Rotate the shifted pixels to bottom (default=False)

This example shifts 2 pixels up

import time
from adafruit_featherwing import neopixel_featherwing

neopixel = neopixel_featherwing.NeoPixelFeatherWing()

# Draw Red and Green Pixels
neopixel[4, 1] = (255, 0, 0)
neopixel[5, 1] = (0, 255, 0)

# Rotate it off the screen
for i in range(0, neopixel.rows - 1):
    neopixel.shift_up(True)
    time.sleep(.1)

time.sleep(1)
# Shift it off the screen
for i in range(0, neopixel.rows - 1):
    neopixel.shift_up()
    time.sleep(.1)