Lights, Gears, Buttons Oh My!


WOW! A whole lot has happened since the last controller post. A whole heckin' ton of changes have been made to code behavior, including the addition of a physical abduction button. Here we go! 

 

Let's talk about this first gif. When I was first prototyping the lighting, I was having a tough time with smooth movement of the lights. I'm using the FastLED library for arduino, which can easily handle LED strip data parsing. In FastLED, there is the ability to use "color palettes" that make it easier to assign color blocks rather than looping through an array. Unfortunately, these pallettes are assigned from a starting LED, and don't "spin" easily since I can only increment dot by dot. 

Instead, I used the library's sine wave function, which takes an input of x and returns a y based off of a sine function. The function by default has an altered range that is 0 to 256, which made my job a lot easier.  During each loop, I assign a value to a LED offset from the previous one, and with all values offset from the encoder's current position (allowing for spin). Additionally, I'm using a velocity variable that increases on spins and decreases naturally over time to change the brightness by remapping the sine wave cap to the velocity amount. This can bring it from 0 to 256 when spinning. 

There are a few "recycled" parts to the controller. The large ball bearings and center piece are all from an old rotary mailbox system we took apart at work. The bearings are placed in a way to prevent strain on the center rotational mechanism when any tilt is added to the top half of the controller. 

The top half of the UFO controller which is the physical part that *actually* spins, I CNC routed a big circle and attached the gear to the underside. I had to decide what material would work best for both grip and ease of cleaning (a high priority if we want to show this to large groups of people). After some discussion, we landed on waterproof black vinyl that's easy to wipe of with lysol wipes. I grabbed the fabric from around the corner at Chicago Fabric Yarn and Button Sales (the owner loves talking to DePaul students!).


Get That UFO Game

Leave a comment

Log in with itch.io to leave a comment.