#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// The pins for I2C are defined by the Wire-library.
// On an arduino UNO: A4(SDA), A5(SCL)
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
// On an arduino LEONARDO: 2(SDA), 3(SCL), ...
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
//Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI);
//uint8_t w, uint8_t h, SPIClass *spi_ptr,
// int8_t dc_pin, int8_t rst_pin, int8_t cs_pin,
// uint32_t bitrate)
//reference state
int button_pin = 2;
void draw_first_shape(){
display.clearDisplay();
}
void setup() {
// put your setup code here, to run once:
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS);
pinMode(button_pin,INPUT_PULLUP);
//for usb communication
Serial.begin(115200);
delay(2000);
// Show initial display buffer contents on the screen --
// the library initializes this with an Adafruit splash screen.
// Clear the buffer
display.clearDisplay();
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // Draw white text
display.setCursor(0,0); // Start at top-left corner
display.println(F(" "));
display.display();
delay(2000);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(6, 6);
// Display static text
display.drawRoundRect(10 , 60 , 10, 5 , 1 , WHITE);
display.drawFastHLine(12, 62, 2, WHITE);
display.drawFastHLine(18, 62, 2, WHITE);
display.display();
delay(2000);
display.startscrollright(0x00, 0x0F);
delay(200);
display.stopscroll();
delay(100);
display.startscrollleft(0x00, 0x0F);
delay(200);
display.stopscroll();
delay(100);
display.fillRoundRect(5 , 5 , 100, 50 , 5 , WHITE);
display.fillTriangle(20,55, 30, 55, 18,58, WHITE);
display.display();
delay(2000);
display.setTextColor(INVERSE);
display.println("Hello!");
display.display();
delay(2000);
display.println("My name is Lite, and I'll be your lil descktop robot for a bit, nice to meet you!");
display.display();
delay(200);
}
void loop() {
display.clearDisplay();
delay(1000);
}