New to electronics, so I'm just toying around with making things work.
I've got an Uno sitting here, with some LEDs and a Ping sensor.
I can get the LEDs and Ping working separately, using the Fade and Ping sketches. What I want to do is to merge them together.
Say the Ping is reading at 10", the LED should be dim, and as the Ping readings get lower, to say 2", the LED gets brighter.
I'm assuming a "simple" if statement in the loop should cover it, but I don't know how to make it. The 10" and 2" settings I can get, it's how I get the in-between stuff to work with the LED that I don't know.
I mean, I could do the math, and set 10" to 0, and 2" to 255, and do the math for all the decimal inches, but surely there's a better way?