#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
#include <Stepper.h>
LiquidCrystal My_LCD(13, 12, 14, 27, 26, 25);
Stepper myStepper(200, 19, 21, 22, 23);
int button_state;
int variavel = 3;
uint8_t setaLado[8] = {
0b00000,
0b00100,
0b00110,
0b11111,
0b11111,
0b00110,
0b00100,
0b00000,
};
uint8_t setaBaixo[8] = {
0b00000,
0b00000,
0b00100,
0b00100,
0b00100,
0b11111,
0b01110,
0b00100,
};
uint8_t setaCima[8] = {
0b00100,
0b01110,
0b11111,
0b00100,
0b00100,
0b00100,
0b00000,
0b00000,
};
uint8_t CPE1[8] = {
0b01100,
0b10000,
0b01100,
0b10000,
0b10100,
0b10000,
0b11100,
0b10000,
};
uint8_t CPE2[8] = {
0b01110,
0b10001,
0b10001,
0b10001,
0b01010,
0b01110,
0b01110,
0b00000,
};
void ajuste_manual(int direcao) {
if(button_state == 0){
myStepper.step(direcao*1);
delay(100);
}
}
void configuracoes() {
My_LCD.setCursor(0,0);
My_LCD.print("Motor 1: Ajuste");
My_LCD.setCursor(0,1);
My_LCD.print("\x01Subir");
My_LCD.setCursor(0,2);
My_LCD.print(" Descer");
My_LCD.setCursor(0,3);
My_LCD.print(" Pronto");
}
void setup() {
My_LCD.createChar(1, setaLado);
My_LCD.createChar(2, setaBaixo);
My_LCD.createChar(3, setaCima);
My_LCD.createChar(4, CPE2);
My_LCD.begin(20, 4);
pinMode(2 , INPUT_PULLUP);
My_LCD.clear();
}
void loop() {
//Música 1
button_state = digitalRead(2);
ajuste_manual(1);
configuracoes();
}