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.
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.
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.
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.
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.
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!")
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!")
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!")
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!")
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.
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.
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.
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
¶ 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)
-
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)
-