I am embarking on a project and I need a little help in simplifying my code. Essentially, part of the project simply involves this:
Input values range from 0 to 1023.
For values >0, the light connected to pin 1 only lights up.
For values >100, the light connected to pins 1 and 2 light up.
For values >200, the light connected to pins 1, 2 and 3 light up.
And so on. I have a total of 9 lights to configure.
As of now, I am manually coding each value to correspond with its output. This means that I have around 10 if-else codes.
Eg. For values above 200, I am using this if-else code.
Are there any suggestions on how I can make this more automated and more concise? I've been toying around with various variables and constants, but have yet to find a way to make the code more concise. Any help would be greatly appreciated. Thank you!