#define Ledred 12
#define Ledblue 26
#define tombol 4
#define trimpot 15
bool a;
int bacatrimpot;
// potensiometer 12 bit
// 2 pangkat 12 sama dengan 4096
// keluaran pin ADC max 3,3 V
//jadi resolusi nya 3,3 V dibagi 4096 samadengan 0,000805
void setup() {
// put your setup code here, to run once:
pinMode(Ledred, OUTPUT);
pinMode(Ledblue, OUTPUT);
pinMode(tombol, INPUT_PULLUP);
pinMode(trimpot, INPUT);
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
bacatrimpot = analogRead((trimpot));
Serial.println(bacatrimpot);
delay(500);
if (a == LOW){
digitalWrite(Ledblue, HIGH);
digitalWrite(Ledred, LOW);
}
else if(a == HIGH){
digitalWrite(Ledred, HIGH);
digitalWrite(Ledblue, LOW);
}
/*
a = digitalRead(tombol);
Serial.println(a);
delay(500);
*/
}
// this speeds up the simulation