Advertisement
RuiViana

Gerador_Meio_Segundo

May 30th, 2016
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include "TimerOne.h"
  2. void setup()
  3. {
  4. pinMode(13, OUTPUT);
  5. Timer1.initialize(500000); // initialize timer1, and set a 1/2 second period
  6. Timer1.attachInterrupt(callback); // attaches callback() as a timer overflow interrupt
  7. }
  8. //--------------------------------------
  9. void callback()
  10. {
  11. digitalWrite(13, digitalRead(13) ^ 1);
  12. }
  13. //--------------------------------------
  14. void loop()
  15. {
  16. // your program here...
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement