Bi-Color 24 Bargraph multiple led's
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- SrGadget
- Posts: 10
- Joined: Wed Aug 31, 2022 11:55 am
Bi-Color 24 Bargraph multiple led's
Question: I recently purchased a Bi-Color 24 Bargraph from you and using it just fine with Arduino nano board. the question I have in the code " bar.setBar(12, LED_GREEN);" if I want easily set say led 0 through and including 11 what would the syntax be ? I have look in your doc's and the forum to no avail I have tried a few thing also with no luck. Any thoughts ideas or guidance would be greatly appreciated....
- dastels
- Posts: 15654
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Bi-Color 24 Bargraph multiple led's
Maybe:
Then call it:
Dave
Code: Select all
void draw_bar(uint8_t first, uint8_t last, uint8_t color) {
for (int led_number = first; led_number <= last; led_number++) {
bar.setBar(led_number, color);
}
}
Code: Select all
draw_bar(0, 11, LED_GREEN);
- SrGadget
- Posts: 10
- Joined: Wed Aug 31, 2022 11:55 am
Re: Bi-Color 24 Bargraph multiple led's
Many thanks Dave I need to read up on using "uint8_t" your a gentleman and a scholar .... Have a good weekend.
- dastels
- Posts: 15654
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Bi-Color 24 Bargraph multiple led's
uint8_t is just a standard type alias for unsigned 8 bit integers. I.e. a byte.
Dave
Dave
Please be positive and constructive with your questions and comments.