#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#define LCD_COLUMNS 16
#define LCD_LINES 2
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
int sa = 14;
int sb = 15;
int trothle = A0;
bool jumlah;
bool jumlah2;
unsigned int gear;
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
lcd.setCursor(4,0);
lcd.print("aracer ");
lcd.setCursor(3,1);
lcd.print("speedtek");
delay(1000);
lcd.clear();
Serial.begin(9600);
pinMode(sa, INPUT);
pinMode(sb, INPUT);
pinMode(trothle, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int rpm = analogRead(trothle);
jumlah = digitalRead(sa);
Serial.println(jumlah);
jumlah2 = digitalRead(sb);
Serial.println(jumlah2);
rpm = map(trothle,0,1023,0,12000);
if (jumlah == 1){
gear ++;
}
if (jumlah2 == 1){
gear --;
}
lcd.setCursor(0,0);
lcd.println(gear);
lcd.setCursor(0,1);
Serial.println(trothle);
delay(50);
}