I have a Leonardo connected to Adafruit 128x32 OLED display and it's working fine. I wanted to look at the I2C SCL line on my scope and I noticed the bus speed appears to be jumping between 100khz and 400khz. Here's a video of my scope: - YouTube
Is it really going back and forth between the two bus speeds? That doesn't make any sense, but I don't know what else to make of the scope output. Here's my sketch:
#include <Wire.h>
#include <Adafruit_GFX.h> // http://github.com/adafruit/Adafruit-GFX-Library
#include <Adafruit_SSD1306.h> // http://github.com/adafruit/Adafruit_SSD1306
#define OLED_RESET 8
Adafruit_SSD1306 display(OLED_RESET);
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
Serial.begin(9600);
delay(4000);
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32)
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("HELLO THERE");
display.setCursor(0,9);
display.println("HAVE A NICE DAY");
display.setTextSize(2);
display.setCursor(0,18);
display.println("more stuff");
display.display();
delay(4000);
pinMode(13, OUTPUT);
}
void loop() {
display.clearDisplay(); // clears the screen and buffer
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("TIME TIME TIME TIME");
display.setTextSize(2);
display.setCursor(0,18);
char buff[12];
display.println(ltoa(millis()/100, buff, 10));
display.display();
Serial.println(millis());
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
delay(50);
}