Download Adafruit_CircuitPython_seesaw Library

To begin reading data from your Joy Featherwing, you will need to download Adafruit_CircuitPython_seesaw from our github repository. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip

Extract the zipped folder. And rename the folder it contains to Adafruit_seesaw.

Plug your CircuitPython device into your computer via the USB cable, and you should see the CIRCUITPY drive appear.

you should have the lib folder already on the drive. If you do not have the lib folder, or you encounter errors due to missing libraries, you can download the latest library package here.

 Drag the Adafruit_seesaw folder you just renamed to the CIRCUITPY/lib folder on your CircuitPython drive. The folder should look like this:

open the file in the root of the CIRCUITPY drive and copy and paste the following code:

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

import time

import board
from micropython import const

from adafruit_seesaw.seesaw import Seesaw

BUTTON_RIGHT = const(6)
BUTTON_DOWN = const(7)
BUTTON_LEFT = const(9)
BUTTON_UP = const(10)
BUTTON_SEL = const(14)
button_mask = const(
    (1 << BUTTON_RIGHT)
    | (1 << BUTTON_DOWN)
    | (1 << BUTTON_LEFT)
    | (1 << BUTTON_UP)
    | (1 << BUTTON_SEL)

i2c_bus = board.I2C()  # uses board.SCL and board.SDA
# i2c_bus = board.STEMMA_I2C()  # For using the built-in STEMMA QT connector on a microcontroller

ss = Seesaw(i2c_bus)

ss.pin_mode_bulk(button_mask, ss.INPUT_PULLUP)

last_x = 0
last_y = 0

while True:
    x = ss.analog_read(2)
    y = ss.analog_read(3)

    if (abs(x - last_x) > 3) or (abs(y - last_y) > 3):
        print(x, y)
        last_x = x
        last_y = y

    buttons = ss.digital_read_bulk(button_mask)
    if not buttons & (1 << BUTTON_RIGHT):
        print("Button A pressed")

    if not buttons & (1 << BUTTON_DOWN):
        print("Button B pressed")

    if not buttons & (1 << BUTTON_LEFT):
        print("Button Y pressed")

    if not buttons & (1 << BUTTON_UP):
        print("Button x pressed")

    if not buttons & (1 << BUTTON_SEL):
        print("Button SEL pressed")


Plug your Joy Featherwing onto the top of your CircuitPython Feather board.

When you open the REPL you should see output when you press buttons or move the joystick.

This guide was first published on Oct 25, 2017. It was last updated on Apr 15, 2024.

This page (Circuit Python Wiring & Test) was last updated on Apr 14, 2024.

Text editor powered by tinymce.