Hi
i’m working on this Oled driver.
when i initialized the screen , many of random dots appears on screen.
how can i reset these dots?
i have got Two lcd but result is same ( many of non-controlled dots)
Hi
i’m working on this Oled driver.
when i initialized the screen , many of random dots appears on screen.
how can i reset these dots?
i have got Two lcd but result is same ( many of non-controlled dots)
Hi, welcome to the forum.
We can't tell what is wrong, because we have to know what you have and what you are doing.
You have a heltec display with SPI. Can you make a photo of it ? or give a link to it ?
Which Arduino board are you using, and how is the display connected ?
Which library are you using ? I suppose the U8Glib ?
The dots could be caused by random values in the screens memory . A clear screen command should fix this.
Do you have a datasheet of the Screen?
Can you post it?
i’m writing own library for this screen.
The oled panel connected to spi interface of arduino uno ( SCK 13, MOSI 11, CS 10, DC 9 )
there are no datasheet from “heltec”, i have got only “SSD1306 datasheet”.
// inslude the SPI library:
#include <SPI.h>
const int OledCS= 10;
const int OledDC= 9;
int Data[1024];
void OLED_command(int com)
{
digitalWrite(OledCS,LOW);
digitalWrite(OledDC,LOW);
delay(1);
SPI.transfer(com);
digitalWrite(OledCS,HIGH);
}
void OLED_init()
{
OLED_command ( 0xAE) ; //DisplayOFF
OLED_command ( 0xa8);
OLED_command ( 0x3f);
OLED_command ( 0xd3);
OLED_command ( 0x00);
OLED_command ( 0x40);
OLED_command ( 0xa0); //0--127 Segment
OLED_command ( 0xc0);
OLED_command ( 0xda);
OLED_command ( 0x02); // 12h
OLED_command ( 0x81); //Contrast Command
OLED_command ( 0x7F); //Contrast Data
OLED_command ( 0xa4); //Display Entire On
OLED_command ( 0xA6) ; // A6 nomal A7 Invert
OLED_command ( 0xd5);
OLED_command ( 0x80);
OLED_command ( 0x8d);
OLED_command ( 0x14) ;
OLED_command ( 0xAF) ;
}
void OLED_write()
{
OLED_command ( 0x21) ; //Column Adresi Belirle
OLED_command ( 0);
OLED_command ( 127);
OLED_command ( 0x22) ; //Page Adresi Belirle
OLED_command ( 0);
OLED_command ( 7);
OLED_command(0x40) ;
digitalWrite(OledDC,HIGH);
delay(2);
for (int i = 0; i < 1024; i++) {
SPI.transfer( Data[i]);
}
digitalWrite(OledCS,HIGH);
}
void setup() {
// set the slaveSelectPin as an output:
pinMode (OledCS, OUTPUT);
pinMode (OledDC, OUTPUT);
// initialize SPI:
SPI.begin();
SPI.setDataMode(SPI_MODE0);
SPI.setClockDivider(SPI_CLOCK_DIV32);
OLED_init();
}
int data , index;
void loop() {
OLED_write();
Data[index++] = data++;
if(index>1024) index = 0;
if(data>255) data = 0;
delay(100);
}
this is My Test Code.
That is a SPI interface, without reset pin.
Why do you want to write your own library ? It could take months. Someone else has already done that for you.
I recently wrote a very simple and small library for SSD1306 (and SH1106) displays, mostly for displaying text. Not the final version, but it might help you along. Do mind: I use some macros for setting CS and DC (and RST), it saves 25% on time compared to using variables for setting the pins. You already have the datasheet for the driver, you will need it if you go over my code.
I like to understand all of my code, it's a bit of a sport, so I write libraries for most things I use, just for the fun of it.
Cheers,
Jack