// Name of ADC channel
int pot1;
float pot1_volt;
// Name of LED Channel
int LED1 = 22; // Active Low
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, welcome to test");
pinMode(LED1, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
pot1 = analogRead(34);
pot1_volt = (float) pot1 * 3.3 / 4095; // using 12 bit & Vref 3.3 Volt
Serial.print("Nilai ADC : ");
Serial.print(pot1); // show ADC Value
Serial.print("\t");
Serial.print("Nilai ADC Tegangan: ");
Serial.println(pot1_volt); // Show Voltage od ADC
delay(300);
blink(LED1, 200, 400);
}
void blink(int channel, int on, int off){
digitalWrite(channel, LOW);
delay(on);
digitalWrite(channel, HIGH);
delay(off);
}