Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédenteDernière révisionLes deux révisions suivantes |
materiels:afficheurs:ard0_96 [2024/01/23 15:37] – [1. Description] phil | materiels:afficheurs:ard0_96 [2024/04/16 22:37] – phil |
---|
| |
===== 0,96" 128x64 OLED 2864 Display module - SSD1306 (I2C) ===== | ===== 0,96" 128x64 OLED 2864 Display module - SSD1306 (I2C) ===== |
[Mise à jour le 21/8/2023] | [Mise à jour le 16/4/2024] |
{{ :materiels:afficheurs:micpyardu.png?nolink|}} | {{ :materiels:afficheurs:micpyardu.png?nolink|}} |
| |
* **x** : position du point par rapport au côté gauche de l'écran. \\ | * **x** : position du point par rapport au côté gauche de l'écran. \\ |
* **y** : position du point par rapport au dessus de l'écran. \\ | * **y** : position du point par rapport au dessus de l'écran. \\ |
* **w** : largeur (du mot Width). \\ | * **w** : largeur (Width). \\ |
* **h** : hauteur (du mot Height). \\ | * **h** : hauteur (Height). \\ |
* **c** : couleur (1=point allumé, 0=point éteint) \\ | * **c** : couleur (1 = point allumé, 0 = point éteint) \\ |
| |
{{ :materiels:capteurs:environnement:code.png?nolink|}} | {{ :materiels:capteurs:environnement:code.png?nolink|}} |
| |
<pane id="tab-arduino"> | <pane id="tab-arduino"> |
<callout type="info" icon="true" title="Bibliothèque OakOLED">En programmation C, C++ l'utilisation des méthodes de la classe **Adafruit_GFX** sur cet afficheur peut se faire par l'intermédiaire de la bibliothèque **OakOLED**. Comme OakOLED dérive de <html><a href="https://learn.adafruit.com/adafruit-gfx-graphics-library/overview" target="_blank" title="Site Adafruit">Adafruit GFX Graphics</a></html> il suffit de créer un objet OakOLED pour accéder aux méthodes de Adafruit_GFX. | <callout type="info" icon="true" title="Bibliothèque Adafruit_SSD1306">En programmation C, C++ l'utilisation des méthodes de la classe **Adafruit_GFX** sur cet afficheur peut se faire par l'intermédiaire de la bibliothèque **Adafruit_SSD1306**. Comme Adafruit_SSD1306 dérive de <html><a href="https://learn.adafruit.com/adafruit-gfx-graphics-library/overview" target="_blank" title="Site Adafruit">Adafruit GFX Graphics</a></html> il suffit de créer un objet Adafruit_SSD1306 pour accéder aux méthodes de Adafruit_GFX. |
\\ \\ | \\ \\ |
**Installer** <html><a href="https://github.com/netguy204/OakOLED" target="_blank">OakOLED</a></html> avec le gestionnaire de bibliothèques de l'IDE. Les méthodes de la classe sont décrites <html><a href="https://webge.fr/dokuwiki/doku.php?id=materiels:afficheurs:graphique" target="_blank"><b>ici</b></a></html>. | **Installer** <html><a href="https://github.com/adafruit/Adafruit_SSD1306" target="_blank">Adafruit_SSD1306</a></html> avec le gestionnaire de bibliothèques de l'IDE. Les méthodes de la classe sont décrites <html><a href="https://webge.fr/dokuwiki/doku.php?id=materiels:afficheurs:graphique" target="_blank"><b>ici</b></a></html>. |
</callout> | </callout> |
| |
{{ :materiels:afficheurs:affssd1306.png?nolink&300|}} | {{ :materiels:afficheurs:affssd1306.png?nolink&300|}} |
<code cpp helloWorld.cpp> | <code cpp helloWorld.cpp> |
// Exemple d'utilisation de la bibliothèque OakOLED | // Exemple d'utilisation de la bibliothèque Adafruit_SSD1306 |
// Description : Affiche "hello, world" | // Description : Affiche "hello, world" |
| |
#include "Wire.h" // Bibliothèques nécessaires | // Bibliothèques nécessaire à l'afficheur |
#include "Adafruit_GFX.h" | #include <Adafruit_SSD1306.h> |
#include "OakOLED.h" | |
| // Constructeurs |
| Adafruit_SSD1306 oled = Adafruit_SSD1306(128, 32, &Wire); // Afficheur |
| |
OakOLED oled; // Construction d'un objet OakOLED | |
| |
void setup() { | void setup() { |
Serial.begin(115200); | // Initialisation |
oled.begin(); | oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Addresse=0x3C pour 128pxx32px |
| |
| // Configuration de l'affichage |
| oled.clearDisplay(); |
oled.setTextSize(1); | oled.setTextSize(1); |
oled.setTextColor(1); | oled.setTextColor(WHITE); |
oled.setCursor(0, 0); | |
| |
oled.println("Hello, World!"); | oled.println("Hello, World!"); // préparation du texte dans le buffer |
oled.display(); | oled.display(); // Transfert buffer -> afficheur |
} | } |
| |
| |
<pane id="tab-micropy"> | <pane id="tab-micropy"> |
| |
=== 2.1 Présentation === | === 2.1 Présentation === |
<callout type="info" icon="true" title="Bibliothèque SSD1306"><html>Les exemples de code de cette page ont été testés sur un afficheur <html><a href="https://www.gotronic.fr/art-module-oled-i2c-gravity-dfr0486-26805.htm" target="_blank">Gravity OLED-2864 (128x64) </a></html> de DFROBOT et un <html><a href="https://www.gotronic.fr/art-module-afficheur-oled-0-96-tf052-28511.htm" target="_blank">Module afficheur OLED 0,96'' TF052</a></html> connectés à un **ESP32** ou à un **Raspberry Pi Pico**. Ces afficheurs sont pilotés par un circuit SOLOMON SYSTECH <html><a href="https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf" target="_blank">SSD1306</a></html>. Sa mise en oeuvre nécessite une bibliothèque. \\ \\ | <callout type="info" icon="true" title="Bibliothèque SSD1306"><html>Les exemples de code de cette page ont été testés sur un afficheur <html><a href="https://www.gotronic.fr/art-module-oled-i2c-gravity-dfr0486-26805.htm" target="_blank">Gravity OLED-2864 (128x64) </a></html> de DFROBOT et un <html><a href="https://www.gotronic.fr/art-module-afficheur-oled-0-96-tf052-28511.htm" target="_blank">Module afficheur OLED 0,96'' TF052</a></html> connectés à un **ESP32** ou à un **Raspberry Pi Pico**. Ces afficheurs sont pilotés par un circuit SOLOMON SYSTECH <html><a href="https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf" target="_blank">SSD1306</a></html>. Sa mise en oeuvre nécessite une bibliothèque. \\ \\ |