Submind YouTube summaries
Thumbnail for John Park's CircuitPython Parsec: Fruit Jam Library - NeoPixels #adafruit

John Park's CircuitPython Parsec: Fruit Jam Library - NeoPixels #adafruit

Watch on YouTube

Video summary

In this episode of John Park's CircuitPython Parsec series, the focus shifts to exploring the capabilities of the Fruit Jam board using Adafruit's high-level peripheral libraries, specifically targeting NeoPixels. The presenter emphasizes how these advanced libraries abstract away complex hardware details such as pin assignments, pull-up/down configurations, and color ordering. By simply importing the peripherals module from Adafruit CircuitPython and instantiating a `FruitJam` object, users gain immediate access to built-in components without needing granular setup instructions. This approach mirrors previous demonstrations with buttons but extends that convenience to lighting elements, allowing developers to interact directly with hardware features like NeoPixels through intuitive method calls rather than low-level configuration code. The tutorial demonstrates the simplicity of initializing and controlling these LEDs by setting properties such as brightness and filling states before displaying changes on the board. A practical example is provided where specific pixels are addressed using their index numbers, allowing individual control over each LED in a strand without manual wiring definitions. The presenter shows how to turn off all lights initially, then selectively illuminate a single pixel at the bottom with white light by setting its RGB values directly. This process highlights the library's ability to manage multiple LEDs efficiently, ensuring that users can quickly prototype interactive projects where specific pixels respond to user input or predefined patterns without writing extensive setup routines for each component. To create an interactive experience, the video integrates button inputs with NeoPixel outputs using a straightforward loop structure. The code iterates through a list of buttons and corresponding pixel indices, checking if each button is pressed to determine which LED should light up. When a button is activated, its associated pixel displays a specific color from a predefined palette, while unpressed pixels remain off or black. This mechanism allows for immediate visual feedback where pressing different combinations of side-mounted buttons triggers distinct lighting patterns on the top row of LEDs. The presenter also notes the importance of including a brief sleep interval between updates to prevent overwhelming the microcontroller with excessive processing demands during continuous operation. Ultimately, this session illustrates how leveraging high-level libraries like `fruitjam` simplifies embedded development by reducing boilerplate code and focusing efforts on creative logic rather than hardware constraints. Users can easily mix button combinations to create complex lighting effects while maintaining clean and readable scripts that are easy to modify or expand upon. The video concludes by reinforcing the value of these tools for rapid prototyping, enabling makers to build engaging projects with minimal effort and maximum flexibility using the Adafruit Fruit Jam platform's integrated peripherals.
Read the full video transcript
For the Circuit Python Parsec today, I'd like to continue looking at the Fruit Jam library. And in the peripheral section, this time we're going to talk about NeoPixels. So, once again, just like with using buttons, uh and I am going to use buttons in this example, but just like we looked at that last week as having a sort of high-level library where you don't need to know things like what pin your buttons are on or if they're pull up or pull down. This high-level library, similar to portal base, gives us access to peripherals that are built right onto the board, right onto this Adafruit Fruit Jam, and it knows where stuff is, so we don't have to get as granular. So, in this case, using NeoPixels is really easy. What I'm going to do is import from Adafruit Fruit Jam peripherals, import peripherals, and then I can set up Fruit Jam as the name of my peripherals object, and then I can call Fruit Jam.NeoPixels. That's it. I didn't have to tell it where they were, how many were in the strand, what the color order was, none of that stuff. It's all known, so I can simply say Fruit Jam.NeoPixels brightness is one. Uh Fruit Jam.NeoPixels fill, I'll turn them all off at first. Fruit Jam.NeoPixels, and I'm going to pick the one on the bottom here, that's NeoPixel uh four starting at index zero. I'm going to set that to a not too bright white, and that's why you see this bottom pixel is lit white here right at the bottom. It's set to zero uh 2020 2020 in hex. And then NeoPixels show. I've also got the buttons set up, so I can then light up the top uh three NeoPixels corresponding to these three buttons that are along the side. And all we do in code is I'm creating a buttons object that has the button three, button two, and button one values in there. So, it's just simply saying Fruit Jam.Button3 returns if it is pressed or not pressed. And then I'm iterating through this little loop. So, for I pressed in enumerate buttons, so look through that list of three things, light up the fruit jam dot neopixels I, so 0 1 or 2, to colors, and I have a little list of colors up here. Uh and if it's pressed, we light it up to that color, and if it is not, then we're going to set it to black. So, that's how we get it lit red when I press the top button and black or off when I release it. You can do these in combos, of course, and it's really uh really nice feedback without doing a whole lot of code. At the end of setting all those colors, you then call fruit jam neopixels show to actually set that state. Uh and then I have a little bit of a sleep here to prevent flooding the thing. So, that is how you can use the peripherals within neopixel library to access your neopixels. And that is your circuit python per sec.