Here is the simple code to read the ADC value and show it in the serial monitor of Arduino ide.
const int Analog_channel_pin= 34;
int ADC_VALUE = 0;
float voltage_value = 0;
void setup()
{
Serial.begin(115200);
}
void loop()
{
ADC_VALUE = analogRead(Analog_channel_pin);
Serial.print("ADC VALUE = ");
Serial.println(ADC_VALUE);
delay(1000);
voltage_value = (ADC_VALUE * 3.3 ) / (4095);
Serial.print(" Voltage = ");
Serial.print(voltage_value);
Serial.println("volts");
delay(1000);
}
Leave a Reply