Can I light up only one bargraph?

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
lbkulinski
 
Posts: 116
Joined: Wed May 07, 2014 4:41 pm

Can I light up only one bargraph?

Post by lbkulinski »

I just ordered two 24-Bar Bargraph w/I2C Backpack Kits for my project and I was wondering if I could only light up one of the two bars with some code while it is on the backpack. Thanks.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Can I light up only one bargraph?

Post by adafruit_support_rick »

You will need to select two different I2C addresses, one for each bargraph display. For instance, 0x70 and 0x71.
https://learn.adafruit.com/adafruit-led ... 2c-address

In your sketch, declare two instances of the bargraph object

Code: Select all

Adafruit_24bargraph bar_1 = Adafruit_24bargraph();
Adafruit_24bargraph bar_2 = Adafruit_24bargraph();

Call begin on each instance, and supply the I2C address for each:

Code: Select all

bar_1.begin(0x70);  // pass in the address of the first bargraph
bar_2.begin(0x71);  // pass in the address of the second bargraph
Now you can control each bargraph separately

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”