Bugs and other nuisances #ElectronicHalloween “Adafruit Industries – Makers, hackers, artists, designers and engineers!

(Part 1, Part 2, Part 3, Part 4) This is probably the second to last of those “Halloween Sprint” posts…if I make one more, it’s probably just the finished costume, then I write the “right” Learning Guide later. As mentioned in part 4, I could have managed to finish the weekend before Halloween, but I took it easy. Luckily, it turned out for the best, because weird things popped up…

Wiring done…just rigged with safety pins for now, I’ll sew a pocket later. It’s a bit of a rat’s nest, partly due to an issue mentioned last time where I didn’t have a good body double to measure, which required me to wire strips to the board of microcontroller rather than the other way around…all the slack in the cable collects in one place and looks bad (although it’s hidden under the coat). Doesn’t affect functionality, it’s just ugly. That’s why I’m making this shakedown version, so the tutorial version can be neater.

The weird part of it was finding a bug in the NeoPXL8 library that only appeared because of this particular hardware/software combo…

I wanted to test another type of WS2812 compatible LED strip from a third party. I bought them some time ago. It has “Eco” in the name, and I had jumped to conclusions at the time that it must be a low-powered thing. Nope! It is the abbreviation of “economical”. They’re addressable LEDs made of less expensive materials…and with a shorter lifespan to match…but for a Halloween costume, it was worth trying out.

Each WS2812 compatible variant has slight differences in signal timing, and I noticed these “Eco” bands flickering occasionally with the Feather M0 I was originally testing with. On M0, M4 and ESP32, the NeoPXL8 code takes some liberties with the timing of the WS2812 protocol to save on RAM. It worked fine with the NeoPixel tapes we have in the store, but it was just borderline for those weird eco-friendly tapes. So I opted for a Feather RP2040, as this version of the code is better able to approximate the “traditional” WS2812 timing. It’s all built around that…and wanting to keep things compact, I didn’t even use any sockets, just soldered connectors straight from Feather to Wing, no backtracking…and then found out nothing worked. lit at all!

The NeoPXL8 examples all ran fine on the exact same hardware, that was only Ooze Master 3000 code not turning on. I’ll save you the long bug-hunting story and just explain that NeoPXL8 on RP2040 doesn’t like to dynamically declare a NeoPL8 object like this:

NeoPXL8 *leds = new Adafruit_NeoPXL8(args);

It’s fine on the Feather M0, only issue manifests on RP2040. This had never happened before because all NeoPXL8 examples use static declarations:

NeoPXL8 leds(args);

The ooze code uses a dynamic declaration because all the LED strips can be of different lengths, and it goes through a table to determine the longest one before allocating it.

So the quick and easy solution was to fix my own version of the code to use a static declaration, already knowing the fixed length of my longest strip. Solves the immediate problem, but a good and proper solution will require finding the problem in the library. It also means that if someone followed to build something similar, and opted for the same Feather RP2040 instead of M0, you would be in the same bind. So it’s a good thing the tutorial doesn’t need to be done this week.

Also added a NeoPixel flame effect to the eyes and dressed up the scythe with string lights. No good reason other than I just wanted more light on things! More lights = more interest, and hopefully someone will see all of this on Halloween and be more inspired to learn more about electronics.

Stop the breadboard and soldering – start crafting right away! Adafruit’s Circuit Playground is packed with LEDs, sensors, buttons, alligator clips, and more. Build projects with Circuit Playground in minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class at code.org, jump into CircuitPython to learn Python and hardware together, TinyGO , or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode and Arduino. It has a powerful processor, 10 NeoPixels, a mini speaker, infrared reception and transmission, two buttons, a switch, 14 crocodile clips and numerous sensors: touch capacitive, IR proximity, temperature, light, motion and sound. A whole world of electronics and coding awaits you, and it fits in the palm of your hand.

Join over 35,000 creators on Adafruit’s Discord channels and join the community! http://adafru.it/discord

Do you have an amazing project to share? The Electronic Show and Tell takes place every Wednesday at 7 p.m. ET! To sign up, head over to YouTube and check out the show’s live chat – we’ll post the link there.

Join us every Wednesday night at 8 p.m. ET for Ask an Engineer!

Follow Adafruit on Instagram for top secret new products, behind the scenes and more https://www.instagram.com/adafruit/

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org

Get the only spam-free daily newsletter on wearable devices, running a “maker business”, e-tips and more! Subscribe on AdafruitDaily.com!

No comments yet.

Adafruit has a “Be Great to Each Other” feedback policy. Help us keep the community here positive and helpful. Stick to the topic, be respectful of creators of all ages and skill levels. Be nice and don’t spam – Thanks!

Previous A group of hackers tried unsuccessfully to hack the Bened Blockchain network
Next How does a credit card consolidation loan work… and is it the right option for you?