State Articles

The concept of 'state' in terms of tracking changes in data over time

  1. 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.

  2. 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.

  3. 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.