Difference between revisions of "OLED Display 1.12"
(→Code) |
(→Code : Hello World!) |
||
| Line 69: | Line 69: | ||
/* | /* | ||
The new OLED module drive IC has two version, | The new OLED module drive IC has two version, | ||
| − | 1. | + | 1. SH1107G |
2. SSD1327 | 2. SSD1327 | ||
Revision as of 18:04, 6 October 2024
Contents
Grove - OLED Display 1.12 inches (Seeed-Studio)
Caractéristiques
16 niveaux de gris
il y a 2 versions
matrix OLED v1.0
96 × 96 dot
Pilote SSD1327
matrix OLED v2.1 *utilisé pour nos tests
128 × 128 dot
Pilote SH1107G
Les deux versions partagent la même bibliothèque qui de base était conçu pour la version 1.0
Communication
Port I2c
Support
Supports both Normal and Inverse Color Display
Supports Continuous Horizontal Scrolling
Pilotes (Drivers)
OLED Display: LY120-96096
Driver I2C:
v1.0 SSD1327Z
v2.1 SH1107G
Voltage
Operating Voltage: 3.3~5V
Mise en route (Setup)
connecter au port I2c
installer la bibliotheque
github -> https://github.com/Seeed-Studio/OLED_Display_96X96
il faut aussi la bibliotheque arduino wire.h
veuillez adapter le code selon la version OLED utilisée
v1.0 -> SeeedGrayOled.init(SSD1327);
v2.1 -> SeeedGrayOled.init(SH1107G);
Exemples
Grove OLED Display 1.12 V1.0
./examples/OLED_SSD1327_v1
Grove OLED Display 1.12 V2.0
./examples/OLED_SH1107G_v2
liste d'exemples:
OLED_Bitmap_Inverse_Display
OLED_Draw_Bitmap
OLED_Hello_World
OLED_Inverse_Display
OLED_PrintNumbers
OLED_Scroll_Left
OLED_Scroll_Right
OLED_Z_Display_Driver_Test_Suite
Code : Hello World!
/*
The new OLED module drive IC has two version,
1. SH1107G
2. SSD1327
Change the paramater of the drive IC name to init the module.
**
** SeeedGrayOled.init(SSD1327); // SSD1327 or SH1107G
**
Copyright - Seeedstudio
Author - lambor
Date - 4/24/2017
*/
#include <Wire.h>
#include <SeeedGrayOLED.h>
#include <avr/pgmspace.h>
void setup()
{
Wire.begin();
SeeedGrayOled.init(SH1107G); //initialize SEEED OLED display
SeeedGrayOled.clearDisplay(); //Clear Display.
SeeedGrayOled.setNormalDisplay(); //Set Normal Display Mode
SeeedGrayOled.setVerticalMode(); // Set to vertical mode for displaying text
for(char i=0; i < 12 ; i++)
{
SeeedGrayOled.setTextXY(i,0); //set Cursor to ith line, 0th column
SeeedGrayOled.setGrayLevel(i); //Set Grayscale level. Any number between 0 - 15.
SeeedGrayOled.putString("Hello World"); //Print Hello World
}
}
void loop()
{
}
Code Hello World! (u8g2)
library of u8g2 (Monochrome graphics library supports OLEDs and LCDs)
#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>
#include <Wire.h>
U8G2_SH1107_SEEED_128X128_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);
void setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB10_tr);
u8g2.drawStr(0,24,"Hello World!");
} while ( u8g2.nextPage() );
}
Liste des fonctions
init()
clearDisplay()
setNormalDisplay()
setContrastLevel(unsigned char ContrastLevel)
setInverseDisplay()
setHorizontalMode()
setVerticalMode()
setTextXY(X,Y)
putChar(unsigned char c)
putString(cont char *string)
putNumber(long n)
drawBitmap(unsigned char *bitmaparray, int bytes)
setHorizontalScrollProperties
activateScroll()
deactivateScroll()
Liens internes
Liens externes
github.com/Seeed-Studio/OLED_Display_96X96/archive/master.zip Librairies ZIP
wiki.seeedstudio.com/Grove-OLED_Display_1.12inch wiki