Example Code for Arduino-Voltage Detection
Last revision 2026/01/15
Wiring Diagram

Sample Code
void setup()
{
Serial.begin(9600);
}
void loop()
{
int val;
float temp;
val=analogRead(0);//This divider module will divide the measured voltage by 5, the maximum voltage it can measure is 25V.
temp=val/40.92; //
val=(int)temp;//
Serial.println(val);
delay(100);
}
Was this article helpful?
