Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. int batMonPin = A3; // input pin for the divider
  2. int val = 0; // variable for the A/D value
  3. int reference = A4; // input pin for the reference via 5v regulator
  4.  
  5.  
  6. void setup()
  7. {
  8.  
  9.  
  10. pinMode(13,OUTPUT); // out put to the relay
  11.  
  12.  
  13. }
  14.  
  15. void loop()
  16. {
  17. val = analogRead(batMonPin); // read the voltage on the divider
  18.  
  19.  
  20.  
  21. if ( analogRead(batMonPin) == analogRead(reference)) // This is to check weather the batt is fully charged
  22.  
  23.  
  24.  
  25. {
  26. digitalWrite(13,HIGH); // stop charging the batt
  27. }
  28.  
  29.  
  30. else
  31.  
  32.  
  33. {
  34.  
  35. digitalWrite(13,LOW); // Contiune to charge the batt
  36.  
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement