#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 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)
int l_button = 3;
int r_button = 2;
void setup() {
// put your setup code here, to run once:
pinMode(r_button,INPUT);
pinMode(l_button,INPUT);
Serial.begin(9600);
screen.begin(SSD1306_SWITCHCAPVCC,address);
screen.clearDisplay();//clears everything off display
}
int circX=10;
int circY=31;
int r=10;
int white=1;
int rectX=100;
int rectY=0;
int width=25;
int height=63;
int count = 0;
int r_count = 0;
void loop() {
int l_val = digitalRead(l_button);
int r_val = digitalRead(r_button);
// put your main code here, to run repeatedly:
Serial.print("l: ");
Serial.print(l_val);
Serial.print(" | r: ");
Serial.println(r_val);
if (l_val == 1 && count == 0){
verse1();
r_count = 10;
}
if(r_count == 10 && r_val == 1){
screen.clearDisplay();
screen.display();
count = 8;
}
if (count == 8 && l_val == 1) {
screen.clearDisplay();
screen.display();
verse2();
screen.display();
r_count = 6;
}
if (r_count == 6 && r_val == 1){
screen.clearDisplay();
screen.display();
count = 9;
}
if(count == 9 && l_val == 1){
screen.clearDisplay();
screen.display();
verse3();
screen.display();
r_count = 5;
}
if(r_count == 5 && r_val == 1){
screen.clearDisplay();
screen.display();
count = 0;
}
}
void verse1(){
screen.setCursor(1,1);//puts cursor in lower left
screen.setTextSize(1);
screen.setTextColor(white);
screen.print("In the same way, let your light shine before others, that they may see your good deeds and glorify your Father in heaven. - Matthew 5:16");
screen.display();
}
void verse2(){
screen.setCursor(1,1);//puts cursor in lower left
screen.setTextSize(1.75);
screen.setTextColor(white);
screen.print("Not looking to your own interests but each of you to the interests of the others. - Philippians 2:4");
screen.display();
}
void verse3(){
screen.setCursor(1,1);//puts cursor in lower left
screen.setTextSize(1.75);
screen.setTextColor(white);
screen.print("Never be lacking in zeal, but keep your spiritual fervor, serving the Lord. - Romans 12:11");
screen.display();
}