<file_sep>/*
 * Wiring :
 *    Sensor Pin      |   Arduino Pin
 * ====================================
 *    +               |   VCC
 *    -               |   GND
 *    S               |   A4
 *    
 */

int analogInput = A4;
float vout = 0.0;
float vin = 0.0;
float R1 = 30000.0; 
float R2 = 7500.0;
int value = 0;

void setup(){
  pinMode(analogInput, INPUT);
  Serial.begin(115200);
  Serial.print("DC VOLTMETER");
}

void loop(){
  value = analogRead(analogInput);
  vout = (value * 5) / 1024.0;
  vin = vout / (R2/(R1+R2));
  
  Serial.print("INPUT V= ");
  Serial.println(vin,2);
  delay(500);
}
<file_sep># Arduino_Uno_DC_Voltage_Sensor
Repository ini berisi source code Arduino Uno dan DC Voltage Sensor.
Adapun rangkaian antara Arduino Uno dan DC Voltage Sensor nya sebagai berikut : 

<table class="table table-striped">
  <thead>
    <tr>
      <th>Sensor Pin</th>
      <th>Arduino Uno Pin</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>-</td>
      <td>GND</td>
    </tr>
    <tr>
      <td>+</td>
      <td>5V</td>
    </tr>
    <tr>
      <td>S</td>
      <td>A4</td>
    </tr>
    <tr>
      <td colspan="2"><img src="https://raw.githubusercontent.com/laurensius/Arduino_Uno_DC_Voltage_Sensor/master/screenshot.jpg" class="img img-responsive"></td>
    </tr>
  </tbody>
</table>
