- There are many ways to do things.
- Some ways are obviously bad.
- Some ways are subtly bad.
- The good way isn’t obvious.
Have you ever thought, “My computer needs way more flashing lights.”?
Now, I’m not talking about meaningless, gaudy special effects. I’m talking about proper blinkenlights.
Adafruit calls them NeoPixels, but their real name is WS2812 or SK6812. They’re handy little RGB LEDs with built-in controllers.
They use a single-wire anisochronous self-clocking signal, so controlling them requires some precise timing. There’s an easy-to-use Arduino library available, but I wanted to use a PIC16F1455, so I had to get into the protocol.
I had a crash reported for one of my Android applications. Thankfully that includes a stack trace, because I would never have found this bug without it. I learned something new about concurrently accessing an ArrayList.
So you need to draw curved and bent pipe-tube-things.
You can make a straight section with two rings of points; just orient one ring like so, the other ring like so, and draw triangles between them. For a curve, just string a bunch of short straight pieces together.
Almost but not quite. Why the hell is there that pinched part in the curved pipe?
The problem is that the orientation of the rings is not as simple as “normal to the pipe’s tangent”. But a ring is a circular-symmetrical thing, right, so rotation about the pipe’s tangent shouldn’t really matter. Right?