Introduction: Battery Tester the Other One, Not ShellSpinner's One.
This is a quick guide to testing a battery.
Step 1: Too Blurry? Let Me Check...
Step 2: Better? No? Hold On...
Step 3: There We Go.
this is how you set up the arduino
Step 4: And Here Is a Digital View
Parts list
3 led
330 ohm resistors
arduino uno r3
battery
programming software
breadboard
wires for arduino
Step 5: And Here Is the Code
#define newLED 2 // green LED 'new'
#define okLED 4 // yellow LED 'ok'
#define oldLED 6 // red LED 'old'
float analogValue = 0;
float voltage = 0;
int ledDelay = 2000;
void setup(){
pinMode(newLED, OUTPUT);
pinMode(okLED, OUTPUT);
pinMode(oldLED, OUTPUT);
}
void loop(){ function(); }
void function(){ analogValue = analogRead(0);
voltage = 0.0048*analogValue;
if(voltage >= 1.6){
digitalWrite(newLED, HIGH);
delay(ledDelay);
digitalWrite(newLED, LOW);
} else if(voltage <1.6 && voltage > 1.4){
digitalWrite(okLED, HIGH);
delay(ledDelay);
digitalWrite(okLED, LOW);
} else if(voltage <= 1.4){
digitalWrite(oldLED, HIGH);
delay(ledDelay);
digitalWrite(oldLED, LOW);
} }