SR04 to control LED Strips

Couple things:

  • You mention this: "WS2813 LED strip" but your code references "WS2812"
  • You state this: " I have used each of these products individually with success."... but then go on to ask: "Do I use analogWrite or digitalWrite (i think digital?) for the LED strip?" (especially if you have already had success in using this led strip? use what you did previously that was successful........no?)

I'm not sure what the difference is between the: WS2813 vs WS2812's?

Maybe check out the Adafruit tutorials on the Neopixel stuff/led strips...

They walk you through how to do non-blocking code that cycles through different animations/patterns with a momentary button press..

Seems tailor made for you..except you swap out the checking of the switch...with your sensor.