Fading makes LEDs look really cool. It's a less abrupt way of transitioning from off to on, or from one color to the next. Even with Neopixels built-in drivers it can still be daunting, and a source of slowdowns in your code. In this tutorial, we'll explore the considerations for fading, walk through a few different approaches, and present a final approach that works especially well with CircuitPython.
Python Articles
The Python programming language
Branching With Git And Testing With Pytest: A Comprehensive Guide: Part 3
This is part three of a three-part series. This is a comprehensive guide to a basic development workflow. Using a simple, but non-trivial web application, we learn how to write tests, fix bugs, and add features using pytest and git, via feature branches. Along the way we'll touch on application design and discuss best practices.
In this installment, we will:
- Simulate collaborative work by two developers.
- Use the workflow we learned in part 2 to add a new feature, and fix a new bug.
- Create a merge conflict and resolve it.
Branching With Git And Testing With Pytest: A Comprehensive Guide: Part 2
This is part two of a three-part series. This is a comprehensive guide to a basic development workflow. Using a simple, but non-trivial web application, we learn how to write tests, fix bugs, and add features using pytest and git, via feature branches. Along the way we'll touch on application design and discuss best practices.
In this installment, we will:
- Identify and fix a bug on a branch.
- Build a new feature, also on a branch.
- Use
git rebase
to keep our change history tidy. - Use tagging to mark new versions of our application.
Branching With Git And Testing With Pytest: A Comprehensive Guide
This is part one of a three-part series. This is a comprehensive guide to a basic development workflow. Using a simple, but non-trivial web application, we learn how to write tests, fix bugs, and add features using pytest and git, via feature branches. Along the way we'll touch on application design and discuss best practices.
In this installment, we will:
- Talk a bit about the design of the example application.
- Ensure we are set up for development.
- Exercise the basics of pytest, and git by writing some tests, adding a fixture, and committing our changes.
State And Events In CircuitPython: Part 3: State And Microcontrollers And Events (Oh My!)
In this part of the series, we'll apply what we've learned about state to our simple testing code from part one.
Not only will we debounce some buttons without blocking, we'll use state to more efficiently control some LEDs.
We'll also explore what happens when state changes, and how we can take advantage of that to do even more complex things with very little code, using the magic of event detection 🌈 .
All of this will be done in an object-oriented fashion, so we'll learn a lot about OOP as we go along.
State And Events In CircuitPython: Part 2: Exploring State And Debouncing The World
In this part of the series, we're going to really dig into what state actually is. We'll use analogies from real life, and then look at how we might model real-life state using Python data structures.
But first, we'll discuss a common problem that all budding electronics engineers have to deal with at some point: "noisy" buttons and how to make them "un-noisy", commonly referred to as "debouncing".
We'll talk about fixing the problem in the worst, but maybe easiest way: by blocking. We'll also talk about why it's bad.
State And Events In CircuitPython: Part 1: Setup
This is the first article in a series that explores concepts of state in CircuitPython.
In this installment, we discuss the platform we're using (both CircuitPython and the Adafruit M0/M4 boards that support it), and build a simple circuit for demonstration purposes. We'll also talk a bit about abstraction.
This series is intended for people who are new to Python, programming, and/or microcontrollers, so there's an effort to explain things as thoroughly as possible. However, experience with basic Python would be helpful.