Libraries Required :
- Adafruit SSD1306
- Adafruit GFX
The code:
// *****************
// install these libraries
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_ADDR 0x3C
// define the i2c address
// if you don't know the address, use a i2c scanner
// you can have over 100 devices connected
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
// this begins the display
display.clearDisplay();
display.setTextSize(2); // range of 1 to 8
display.setTextColor(WHITE);
display.setCursor(0, 0); // first position on left
display.println("Welcome");
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 17); // 17 positions dowm
display.println("Page 1"); // just like a serial printer
display.println("intro");
display.println("display");
display.display();
//display function.
// this is very impt .. it prints everything
// from memory to the screen
delay(5000);
}
void loop() {
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("Jono");
display.println("page 2");
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 35);
display.println("jondent");
display.println("Synth Blog");
display.println("jondent808@gmail.com");
display.display();
delay(5000);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0); // 0 = collumn, 0 = row
display.println("Jon's test");
display.println("page 3");
display.display();
delay(5000);
}
// ******************
---------------------------------
-------------------------------------
No comments:
Post a Comment