Introduction: Easy Arduino

https://www.instructables.com/id/Easy-Arduino-Batt...

This is a battery tester that is made with Arduino, the reason that I make this is because last time I went out to play with a car, but the battery is out of power, so I can't play, therefore, to solve this kind of problem, I made this battery tester.

Supplies

10K Resistors (3)Jumper Wires (12)Red LED Light (1)Yellow LED Light (1)RGB LEB Light (1)Alligator cable/clips (2)BatteryBattery case (1)

Step 1: Step 1 Prepare ( What You Need )

You need to have 10K Resistors (3)Jumper Wires (12)Red LED Light (1)Yellow LED Light (1)RGB LEB Light (1)Alligator cable/clips (2)BatteryBattery case (1)

Step 2: Step 2 Make Your Battery Tester

Step 3: Step 3 Coding

int value =0; // the "charge" of the battery

void setup() {

Serial.begin(9600);

pinMode(9,OUTPUT); //改digital

pinMode(10,OUTPUT);//改digital

pinMode(11,OUTPUT); // sets the pins to either n output or return values//改digital

pinMode(A0,INPUT); }

void loop() {

value=analogRead(A0); //reads the battery value from A0

Serial.println(value); //prints the battery "value" to the computer

if (value>=290) //if the charge is high it turns the light green

{

digitalWrite(9,HIGH);//改digital

digitalWrite(10,LOW);//改digital

digitalWrite(11,LOW);//改digital

} else if (value>=180 && value<=289) //if the charge is in between the two values it turns on the yellow light

{

digitalWrite(11,HIGH);//改digital

digitalWrite(9,LOW);//改digital

digitalWrite(10,LOW);//改digital

} else if (value<=179) //if the charge is low it turns on the red light

{

digitalWrite(11,HIGH);//改digital

digitalWrite(10,LOW);//改digital

digitalWrite(9,LOW);//改digital

} }

Step 4: Step 4 Make It Look Better