#include <Adafruit_SSD1306.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
//12 + 48 is 60.
int up_button = 2;
int down_button = 3;
int screen_width = 128;
int screen_height = 64;
int squarex = 3;
int squarey = 4 ;
int squarew = 2;
int squareh = 20;
int colour = 1;
int opponet = digitalRead(up_button);
int readdown = digitalRead(down_button);
//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(up_button,INPUT);
pinMode(down_button,INPUT);
// put your setup code here, to run once:
screen.begin(SSD1306_SWITCHCAPVCC,60);
screen.clearDisplay();//clears everything off display
Serial.begin(9600);
}
void loop() {
screen.drawRect(120,squarey,squarew,squareh,colour);
screen.drawRect(squarex,squarey,squarew,squareh,colour);
if (digitalRead(up_button) == 1){
squarey=squarey-1;
delay(5);
}
if (digitalRead(down_button) == 1){
squarey=squarey+1;
delay(5);
}
screen.display();
screen.clearDisplay();
}