const int pinSensor = 32;
int adcValue = 0;
double volt = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(pinSensor, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
// akuisisi nilai ADC sensor LDR
adcValue = analogRead(pinSensor);
volt = adcValue * 3.3 / 4095;
// cetak nilai ADC ke serial monitor
Serial.print("nilai adc: ");
Serial.println(adcValue);
Serial.print("nilai tegangan: ");
Serial.println(volt);
// jeda akuisisi data
delay(1000); // this speeds up the simulation
}