SETB 2113 INTRODUCTION TO PROGRAMMING
ArduinoBatteryProject
The source code for this project
float refvolts = 5.0;
int inputPin1 = A1;
int inputPin2 = A2;
void setup() {
Serial.begin(9600);
}
void loop() {
int val1 = analogRead(inputPin1);
int val2 = analogRead(inputPin2);
float volts1 = (val1/1023.0)*refvolts ;
float volts2 = (val2/1023.0)*refvolts ;
Serial.print("Volts1 = ");
Serial.println(volts1);
Serial.print("Volts2 = ");
Serial.println(volts2);
delay(1000);
}
The diagram of this project:
PREVIOUSDairy 3