Hey all, after doodling with the Core, Photon, and Electron, I finally finished a project- TV backlighting that is driven by the current time of sunset/twilight. I used a 1-meter strip of 2812 LEDs, with 144 to the meter, and then cut about a dozen off one end so it would fit my TV and a 10A 5V power supply to feed both the LEDs and the Particle. I then used some double-sided tape to stick the Photon on the back of the TV and wrote some code.
Since I’m much more a coder than an electronics cat, I wanted to leave the time on the Photon in UTC and just shift all my calculations. I’m on the US West Coast, so I’m 7 or 8 hours off, which explains the weird times in the conditionals.
Here’s the code. Thanks to the @BulldogLowell for the “sunrise” library, which kept me from dealing with the messy math. (though- feature request- let me query for “time until sunset”/“time since last sunset” with relative numbers?)
(yes, the 2812s are overkill for this)