SHARE
TWEET

Untitled

a guest Jul 12th, 2014 210 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. /*
  3. This is an example to use RTChardware library
  4. RTChardware is meant to use with tm4c129 wich suports calendar mode.
  5.  
  6. There's a bug with the year and week day so those don't work
  7.  
  8. This shows how to set up a interrupt every second
  9.  
  10. Created 21/06/2014
  11. */
  12. #include <RTChardware.h>
  13.  
  14. //Variables to store values
  15. long int Time[3];
  16. long int Date[4];
  17.  
  18. boolean state = false;
  19. unsigned long count = 0;
  20. void test(){
  21.  Serial.println("hey, i'm a second");
  22.  state = !state;
  23.  count++;
  24. }
  25.  
  26. void setup()
  27. {
  28.   Serial.begin(9600);
  29.   RTC.begin(); //Initiaes clock
  30.   pinMode(PN_1, OUTPUT);
  31.   RTC.setInterrupt(test,0,0,1); //set interrupt to fuction "test" every 1 second. you can set any interval, until 23:59:59.
  32. }
  33.  
  34. void loop()
  35. {
  36.   digitalWrite(PN_1, state);
  37.   Serial.println(count);
  38.   delay(500);
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top