#include <Adafruit_SSD1306.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
int address = 60; //0x3C; //means 12 (C) plus 3 16s or 48
//12 + 48 is 60.
int r_button = 2;
int l_button = 3;
int screen_width = 128;
int screen_height = 64;
//declaring my new lcd and naming it "screen
Adafruit_SSD1306 screen(screen_width,screen_height,&Wire, -1);
//(pixels wide, pixels tall, wire library, -1 is for the uno board reset pin)
void setup() {
pinMode(r_button,INPUT);
pinMode(l_button,INPUT);
Serial.begin(9600);
// put your setup code here, to run once:
screen.begin(SSD1306_SWITCHCAPVCC,address);
screen.clearDisplay();//clears everything off display
}
int height = 10;
int width = 20;
void loop() {
//parameters (x position, y position, width, height, color);
//screen.drawRect(screen_width/2 - width/2,screen_height );
screen.drawRect(screen_width/2-width/2,screen_height/2 - height/2, width,height,1);
while(width<128){
screen.display();
width++;
height++;
print_x_y();
delay(50);
//screen.clearDisplay();
}
}
void print_x_y(){
Serial.print("height: ");
Serial.print(height);
Serial.print(" | width: ");
Serial.println(width);
}