I bought one of those cheap 0.96" OLED Displays from china, ebay.
In the product description it states that it's a I2C Display, Ebay Link.
I want to use it with an ATmega8.
I connected it accordingly to the tutorials I found online:
- Pin1, GND: GND
- Pin2, VCC: VCC (3.3V)
- Pin3, D0: Pin28, SCL (Pullup to 5V)
- Pin4, D1: Pin27, SDA (Pullup to 5V)
- Pin5, RST, PORTB.0
- Pin6, DC: PORTB.2
- Pin7, CS: PORTB.1
and this is my code (99% the same as on the library's github page):
#define F_CPU 1000000
#include <util/delay.h>
#include <stdint.h>
#include "libs/SSD1306.h"
int main(void){
DDRB=0xFF;
DDRC=0xFF;
PORTB = PORTB & ~(1<<PB0);
PORTB = PORTB & ~(1<<PB1);
PORTB = PORTB | (1 << PB0);
_delay_ms(100);
// This is our buffer
// Each byte = 8 pixels on the screen
uint8_t buffer[1024];
// Only two lines of code to initiate the driver
// and to send our framebuffer
SSD1306 myDisplay;
PORTB = PORTB | (1 << PB2);
myDisplay.sendFramebuffer(buffer);
PORTB = PORTB & ~(1<<PB2);
// Hardware function to reverse the pixels
// (swap black and white pixel)
myDisplay.invert(1);
// Revert back to normal display
myDisplay.invert(0);
return 0;
}
I use (or want to use) this library: Github
Just because I found it and thought it looked nice, could use another as well.
What I checked so far is:
- Cable connections are okay and as described above
- System clock is 1 MHz
- Tested another display
In every case, the display remains dark and black, not even a flickering.
When I looked at the backside of the display, I thought the description is strange (see the attached image).
There is written, that for IIC connection, resistors R1, R4, R6, R7 and R8 would need to be connected, while, in fact, only R3, R4 are connected, what would correspond to SPI connection. Am I misinterpreting something or was the ebay description wrong?
Can anyone help me?
Kind Regards
Me
Best Answer
Based on previous answer.
Move the resistor from position R3 to R1.
Connect R8.
Result:
Example of usage:
Code (sketch):