Hello. I just bought thid led bard: LED BARD grove and i have some problem coding what i want it to do.
This led bard comes with a library that contains this function: bar.singleLed(X, Y) where X is the number of the led (from 0 to 10) and Y is 1 or 0 (on or off). What i want this bar to do is this:
I have a MAX and MIN defined at the beggining of the program. Next i want to read an INT from serial monitor using parseint(). Now comes the part where i got stuck:
If this value read from the monitor is 10% of MAX or lower - light first led.
If it`s 20% of MAX or lower (but higher than 10%), light first 2 leds, and so on untill 100% of MAX or lower (but higher than 90%) - where all leds should light up.
But i just got stuck at this part... I know that if 5 leds are light up, and the next value is lower than the value that lit 5 leds, i need to turn off some leds.
Can somebody help me with this part? Where i light the leds according to the value i read from serial.monitor just like a EQUALIZER?