Photon: Rotating Indicator Lights with HTTP Server

I had need of using Photons as indicator lights while scanning inventory. We use the lights to indicate if we can send things to an Amazon warehouse or give feedback for placing stock in boxes. The use case required the lights be animated and support two color output for feedback.

Code is here: https://gist.github.com/kordless/e44306568d90bf1baf046dcf8d2c0500

This code includes the following features:

  • serves a simple HTTP API for setting lights
  • one or two color indicators
  • static or rotating animation (cw or ccw)
  • configurable number of LEDs to show for the first color
  • setting initial rotation speed
  • setting rotation duration
  • sleep mode enabled after no API calls
  • sleep warning
  • deep sleep mode w/ push to wake
  • GET to a URL on boot to notify awake (needs sleep warning)
  • “cop mode” via button push

Enjoy,

Kord

2 Likes