adafruit / Adafruit_SSD1306

Arduino library for SSD1306 monochrome 128x64 and 128x32 OLEDs
http://www.adafruit.com/category/63_98
Other
1.75k stars 964 forks source link

New constructors ignore arguments #206

Closed nonchip closed 3 years ago

nonchip commented 3 years ago
/* from the header file:
   Adafruit_SSD1306(uint8_t w, uint8_t h, TwoWire *twi = &Wire,
                   int8_t rst_pin = -1, uint32_t clkDuring = 400000UL,
                   uint32_t clkAfter = 100000UL);
*/
Adafruit_SSD1306 display(128, 64);
void setup(){
  display.begin(SSD1306_SWITCHCAPVCC,0x3C);
}
void loop(){
  display.clearDisplay();
  display.setCursor(0,0);
  display.setTextColor(WHITE,BLACK);
  display.setTextSize(2);
  display.setTextWrap(false);
  char buf[3];
  sprintf(buf,"%02d",display.height()); // <-- should return 64
  display.println(buf);
  display.display();
}

result: image

the value is incorrectly 32, and every 2nd line is blank. interestingly though, it doesn't appear stretched vertically.

nonchip commented 3 years ago

nevermind, sorry, arduino had some cached objects lying around it was using instead of my current code x_x