Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int batMonPin = A3; // input pin for the divider
- int val = 0; // variable for the A/D value
- int reference = A4; // input pin for the reference via 5v regulator
- void setup()
- {
- pinMode(13,OUTPUT); // out put to the relay
- }
- void loop()
- {
- val = analogRead(batMonPin); // read the voltage on the divider
- if ( analogRead(batMonPin) == analogRead(reference)) // This is to check weather the batt is fully charged
- {
- digitalWrite(13,HIGH); // stop charging the batt
- }
- else
- {
- digitalWrite(13,LOW); // Contiune to charge the batt
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement