Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

SSD1306 'display' Object name?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

SSD1306 'display' Object name?

by AtomicPenguin on Tue Aug 18, 2020 1:27 pm

Question from a "C-challenged" person:

I am (successfully) running the OLED_Display_Test example. In that example, the line below declares? defines? the parameters for an object(?) named 'display'. (The word 'display' shows up as orange in the IDE.)

Adafruit_SSD1306 display (SCREEN_WIDTH, SCREEN_HEIGHT,
OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

It appears that the only name that this statement will accept is 'display' (any other name does not show up as orange). Is that something hard-coded into the Adafruit_SSD1306.h library?

Also - does that mean that I can not have TWO instances of the SSD1306 OLED display? (with different names like 'display' and 'display2')

I am guessing that there is something fundamental that I am not understanding here.

AtomicPenguin
 
Posts: 24
Joined: Fri May 16, 2014 5:54 pm

Re: SSD1306 'display' Object name?

by adafruit_support_carter on Tue Aug 18, 2020 5:22 pm

It's creating an instance of a Adafruit_SSD1306 class, assigning it to a variable named display, and passing in various parameters.

The colorization is simply a feature of the IDE. There's nothing special about the name display.

You can create a second instance, but would need to specify a separate CS pin.

adafruit_support_carter
 
Posts: 17323
Joined: Tue Nov 29, 2016 2:45 pm

Re: SSD1306 'display' Object name?

by AtomicPenguin on Wed Aug 19, 2020 2:11 pm

Thanks for your prompt response.

There are still some aspects of this that I do not understand (I am trying to insert the OLED statements in a giant complex code) - but we have had intermittent power outages here in CA for the last 5 days, and I am not sure when I will have time to continue my investigation.

AtomicPenguin
 
Posts: 24
Joined: Fri May 16, 2014 5:54 pm

Re: SSD1306 'display' Object name?

by adafruit_support_carter on Wed Aug 19, 2020 3:23 pm

Try working your way towards the final complex setup in small steps. You've got the basic example working. So you know the hardware is OK. And you can always go back to that as a sanity check. Try using that as a reference and make small changes to get it closer to what you want to happen. And then more small changes, etc. You'll learn more with each step and at some point will understand enough to be able to better integrate it into your final code.

adafruit_support_carter
 
Posts: 17323
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.