Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 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. delay (10000); // 10 secs delay
  27. digitalWrite(13,HIGH); // stop charging the batt
  28. }
  29.  
  30.  
  31. else
  32.  
  33.  
  34.  
  35. {
  36.  
  37. digitalWrite(13,LOW); // Contiune to charge the batt
  38.  
  39. }
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement