adafruit_featherwing.motor_featherwing

Helper for using motors with the Motor FeatherWing.

  • Author(s): Scott Shawcroft

adafruit_featherwing.ina219_featherwing

Helper for using the INA219 FeatherWing.

  • Author(s): Kattni Rembor

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)