• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

The Coding Couple

Pair programming is a lifetime commitment.

  • Home
  • Categories
    • Arduino
    • JavaScript
    • Python
    • Raspberry Pi
  • About Us
    • Privacy Policy
  • Contact

Tinkering Around with Adafruit’s PyBadge LC

June 19, 2019 by Ashley

I recently purchased an Adafruit PyBadge LC. and I’ve had a lot fun tinkering around with it. There are three boards in this family of boards from Adafruit:

  • PyBadge LC (the one I have)
  • PyBadge
  • PyGamer

The PyBadge LC is the cheapest of the bunch, hence the LC for low cost. For more details on the differences between the boards check out Adafruit’s comparison guide here.

Each board supports programming with Arduino, CircuitPython, and MakeCode Arcade. I love Python and this has been a great opportunity to learn how to use CircuitPython.

Adafruit PyBadge Projects

This blog post will serve as an place for me to document some of my PyBadge projects. I also create a repo on GitHub to store my code.py files.

Conference Badge

Adafruit has a Learning Guide on how to make a conference badge with the PyBadge. I loaded the CircuitPython script onto my PyBadge with a few modifications of my own.

I updated the main loop to handle user input from the start and select buttons. When the buttons are pressed the conference badge’s background color updates.

Here are the modified excerpts. The full script is on GitHub.

First I created a list of colors.

VIOLET = 0x9400D3
INDIGO = 0x4B0082
BLUE = 0x0000FF
GREEN = 0x00FF00
YELLOW = 0xFFFF00
ORANGE = 0xFF7F00
RED = 0xFF0000
RAINBOW_COLORS = [VIOLET, INDIGO, BLUE, GREEN, YELLOW, ORANGE, RED]

Then I modified the main loop to reference the RAINBOW_COLORS list when the user clicks on the start or select buttons.

current_buttons = pad.get_pressed()
last_read = 0
color_index = 0
while True:
    for color in range(0, 360, speed):
        # omitting other code
        if current_buttons != buttons:
            # Respond to the buttons
            if (buttons & BUTTON_START):
                if color_index + 1 == len(RAINBOW_COLORS):
                    color_index = 0
                else:
                    color_index += 1
                splash[0].pixel_shader[0] = RAINBOW_COLORS[color_index]
            elif (buttons & BUTTON_SEL):
                if color_index - 1 == -1:
                    color_index = len(RAINBOW_COLORS) - 1
                else:
                    color_index -= 1
                splash[0].pixel_shader[0] = RAINBOW_COLORS[color_index]
            current_buttons = buttons

Animating a Sprite with Adafruit’s PyBadge

My next PyBadge project was a simple CircuitPython script that loaded a sprite sheet and animated it. When Michael and I first started this blog I whipped up a pair of sprites of our likeness for branding. I decided to take my sprite to the next level with a sprite sheet. I used the online pixel editor, Piskel, to create the art.

Ashley’s animated sprite

I used Adafruit’s Learning Guide on CircuitPython Display Support using displayio as a starting point for this small project. Full code for my PyBadge script is on GitHub.

What’s Next?

I have a few more skill builder projects that I would like to tackle and then I’ll be ready to implement a couple of cool projects I thought of for the PyBadge.

Related Posts

  • Retroflag SuperPi Raspberry Pi Case ReviewRetroflag SuperPi Raspberry Pi Case Review
  • Using WSL on Corporate VPNUsing WSL on Corporate VPN
  • Getting started with Phaser and ES2015Getting started with Phaser and ES2015
  • How to watermark images with Python and Pillow (PIL)How to watermark images with Python and Pillow (PIL)
  • Pokémon Color Picker | A web app built with HTML/CSS + JavaScriptPokémon Color Picker | A web app built with HTML/CSS + JavaScript
  • Creation Crate Month 2: An Arduino Powered Memory GameCreation Crate Month 2: An Arduino Powered Memory Game

Filed Under: Arduino, Python

Previous Post: « I made a Sphere-O-Bot (An EggBot Mod)
Next Post: JavaScript’s Null Coalescing Operator | Today I Learned »

Primary Sidebar

Social Media

  • GitHub
  • Instagram
  • Twitter
  • YouTube

Recent Posts

  • Pokémon Color Picker | A web app built with HTML/CSS + JavaScript
  • Pokéball Single DIV CSS Drawing | Tutorial
  • Error: [🍍]: “getActivePinia()” was called but there was no active Pinia
  • Trijam #261 Game Jam Diary: One Wrong Move
  • Using WSL on Corporate VPN

Recent Comments

  • Lizzy on Creation Crate Month 2: An Arduino Powered Memory Game
  • Ashley Grenon on Creation Crate Month 2: An Arduino Powered Memory Game
  • Lizzy on Creation Crate Month 2: An Arduino Powered Memory Game
  • kelly on Creation Crate Month 2: An Arduino Powered Memory Game
  • Ashley on Creation Crate Month 3: An Arduino Powered Distance Detector

Follow us on Instagram!

This error message is only visible to WordPress admins

Error: No feed found.

Please go to the Instagram Feed settings page to create a feed.

Categories

  • Arduino
  • Conferences
  • Debugging
  • Game Jams
  • HTML and CSS
  • JavaScript
  • Programming Languages
  • Python
  • Raspberry Pi
  • Today I Learned

Archives

  • May 2024
  • April 2024
  • March 2024
  • May 2022
  • December 2021
  • May 2021
  • March 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • June 2019
  • April 2019
  • September 2017
  • April 2017
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • April 2015
  • January 2015

Tags

adafruit arduino brackets c# code smell codestock coding standards conventions creation crate debugging developer devspace electronics es6 es2015 game development game jam gotcha hackathon hoisting html html5 javascript led naming conventions nintendo phaser pluralsight pokemon programmer python raspberry pi retro retropie scope self improvement single div single div drawing subscription box TIL today I learned troubleshooting vue vuejs windbg

Footer

About Us

We are the Coding Couple.  Two people who met in college and decided they wanted to pair program for the rest of their ...

Read More »

Most Recent Posts

Pokémon Color Picker | A web app built with HTML/CSS + JavaScript

Pokéball Single DIV CSS Drawing | Tutorial

Error: [🍍]: “getActivePinia()” was called but there was no active Pinia

Trijam #261 Game Jam Diary: One Wrong Move

Social Media

  • GitHub
  • Instagram
  • Twitter
  • YouTube

Copyright Notice

© The Coding Couple, 2015 – 2023. Excerpts and links may be used, provided that full and clear credit is given to The Coding Couple with appropriate and specific direction to the original content.

Copyright © 2025 · Foodie Pro Theme by Shay Bocks · Built on the Genesis Framework · Powered by WordPress