#include <LiquidCrystal.h>
#define pot A1
LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);
byte Modo1[8] = {
31,31,31,0,0,0,0,0};
byte Modo2[8] = {
0,0,0,0,0,31,31,31};
byte Modo3[8] = {
31,31,31,0,0,0,31,31};
byte Modo4[8] = {
28,30,31,31,31,31,30,28};
byte Modo5[8] = {
7,15,31,31,31,31,15,7};
byte Modo6[8] = {
31,31,31,31,31,31,31,31};
byte Modo7[8] = {
0,0,0,0,0,0,0,0};
void setup() {
pinMode(pot, INPUT);
lcd.createChar(1, Modo1);
lcd.createChar(2, Modo2);
lcd.createChar(3, Modo3);
lcd.createChar(4, Modo4);
lcd.createChar(5, Modo5);
lcd.createChar(6, Modo6);
lcd.createChar(7, Modo7);
lcd.begin(16, 2);
Serial.begin(9600);
}
void loop() {
int Numeros [10][6] =
{
{
6,1,6,6,2,6 }
,
{
1,6,7,2,6,2 }
,
{
1,3,4,5,2,2 }
,
{
1,3,4,2,2,4 }
,
{
6,2,6,7,7,6 }
,
{
6,3,1,2,2,4 }
,
{
6,3,1,6,2,4 }
,
{
1,1,4,7,6,7 }
,
{
5,3,4,5,2,4 }
,
{
5,3,6,7,7,6 }
,
};
int valor = analogRead(pot);
int t = map(valor,0,1023,0,999);
int u=t%10;
int u1=((t-u)%100)/10;
int u2=(t-(u1*10)-u)/100;
int Valor [3] = {
u2,u1,u };
for (int p=0;p<=2;p++){
for (int j=0;j<=1;j++){
for (int k=0;k<=2;k++){
lcd.setCursor(k+(p*4),j);
if (j==0) {
lcd.write(Numeros [Valor[p]][k]);
lcd.setCursor(13,j);
lcd.println("RPM");
}
else if (j==1){
lcd.write(Numeros [Valor[p]][k+3]);
}
}
}
//delay(1000);
//lcd. clear();
//delay(500);
}
}