#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define ANCHO 128
#define ALTO 64
#define OLED_RESET 4
Adafruit_SSD1306 oled(ANCHO,ALTO, &Wire, OLED_RESET);
//JOYSTICK____________
int ho; //horizontal
int x=0; //acumulador horizontal
int ve; //vertical
int y=0; //acumulador vertical
int pu; //pulsador
int pinpu=10; //pin pulsador
int fase=0 //acumulador pulsador
void setup() {
Wire.begin();
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
//JOYSTICK____________
pinMode(pinpu, INPUT);
oled.clearDisplay();
}
void loop() {
//JOYSTICK____________
ve = analogRead(A0);
ho = analogRead(A1);
pu = digitalRead(10);
if ( pu == HIGH ){
fase=fase+1;
oled.clearDisplay();
delay(400);
}
if ( ve<450 ){
x=x+1;
oled.clearDisplay();
delay(400);
}
if ( ve>570 ){
x=x-1;
oled.clearDisplay();
delay(400);
}
if ( x>3 || x<0){
x=0;
}
oled.drawTriangle(0,17+(x*13),5,21+(x*13),0,25+(x*13),WHITE);
oled.display();
//MENU
oled.setTextColor(WHITE);
oled.setCursor(0,0);
oled.setTextSize(1);
oled.print("MENU DE CONTROL");
oled.setCursor(10,17);
oled.print("INICIAR");
oled.setCursor(10,30);
oled.print("TIMER");
oled.setCursor(10,43);
oled.print("TEMPERATURA AMB");
oled.setCursor(10,56);
oled.print("TEMPERATURA WTR");
oled.display();
}