What you'll need to get started is a Pro Micro/Elite C/any Arduino, some RGBs, and a switch (and some wire!). Here's what I got:
- SparkFun Qwiic Pro Micro - USB-C
- Neopixel/Neopixel Clone RGBs - You can get a bunch of different kinds of these! These are just the ones I picked.
- NovelKeys Big Switch - Obviously you can use any switch, or button, but these were the inspiration for this project.
I'll assume you've worked with Pro Micros before, but if you haven't, here's a setup guide to get the Arduino IDE and associated drivers on your system.
Now that you have your Pro Micro setup, make sure you can see it on your computer, using Device Manager, or QMK Toolbox if you have that installed, or Arduino's IDE. A lot of Pro Micros come bricked, so hopefully yours is working. The Elite Cs are usually more reliable, but only 2 out of the 3 Pro Micros I used to prototype this project were recognized in Windows.
While most of the code is explained in the file itself, I'll go over the general reasoning for why I did what I did.
My code basically swaps between modes when I press a button, since I wanted a few different colors for my LEDs - RGB cycling, Solid Pink, and "off" (Black). I used the FastLED library to control the LEDs, and the Bounce2 library to add debounce, and everyone online seemed to suggest it when using buttons.
For the color cycling, I stole the code from somewhere, but it's pretty self explanatory, the H part of the HSV infinitely increments over time, resulting in smooth color changing of the LEDs.
If you don't get anything, feel free to message me on reddit! I'll try my best to explain it. My username is /u/schmintendo.
The HSV in FastLED and typical HSV color codes are not the same. This is documented here: https://github.com/FastLED/FastLED/wiki/FastLED-HSV-Colors I might make a FastLED HSV to normal HSV converter at some point, but for now, here are the calculations to change the typical color codes from a HSV color selector like this one to FastLED HSV codes:
FastLED H: (H*256)/360
FastLED S: (S*256)/100
FastLED V: (V*256)/100
If you want a QMK version of this project, check out this link: https://www.reddit.com/r/MechanicalKeyboards/comments/7oiv5o/guide_how_to_make_a_big_switch_lamp/
That was my inspiration, and that person used QMK so you don't have to use Arduino compatible ATmega32U4 boards. Hint hint, use an Elite C.