#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
void langPick();
#define language 12
#define buttonPin 2
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// 141
int potVal = 0;
int realVal = 0;
int buttonState = 1;
void setup() {
// put your setup code here, to run once:
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
pinMode(buttonPin, INPUT_PULLUP);
pinMode(language, INPUT);
pinMode(11, OUTPUT);
digitalWrite(11, HIGH);
display.setTextColor(WHITE);
langPick();
}
void loop() {
}
void langPick() {
int switchState = 0;
int languagePick = 0;
while (buttonState == HIGH) {
switchState = digitalRead(language);
buttonState = digitalRead(buttonPin);
if (switchState == HIGH) {
display.clearDisplay();
display.setTextSize(3);
display.setTextWrap(false);
display.setCursor(127, 48);
display.print("EN");
display.fillRoundRect(16, 34, 61, 49, 10, 1);
display.setTextColor(0);
display.setCursor(30, 48);
display.print("LT");
display.display();
languagePick = 1;
delay(100);
}
else {
display.clearDisplay();
display.setTextColor(1);
display.setTextSize(3);
display.setTextWrap(false);
display.setCursor(30, 48);
display.print("LT");
display.fillRoundRect(113, 34, 61, 49, 10, 1);
display.setTextColor(0);
display.setCursor(127, 48);
display.print("EN");
display.display();
languagePick = 0;
delay(100);
}
}
if (languagePick == 1) {
display.clearDisplay();
display.setTextSize(2);
display.setTextWrap(false);
display.setCursor(28, 21);
display.print("LT");
display.display();
}
else {
display.clearDisplay();
display.setTextSize(2);
display.setTextWrap(false);
display.setCursor(84, 21);
display.print("EN");
display.display();
}
buttonState = 1;
}