Advertisement
Guest User

Untitled

a guest
Oct 12th, 2013
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include "simpletools.h" // Include simpletools header
  2. #include "ping.h" // Include ping header
  3.  
  4. int main() // main function
  5. {
  6. print("Warming up...");
  7. pause(20000);
  8. while(1) // Repeat indefinitely
  9. {
  10. int PIR = input(14);
  11. print("PIR = %d\n", PIR);
  12. if(PIR == 1)
  13. {
  14. int cmDist = ping_cm(15); // Get cm distance from Ping)))
  15. print("cmDist = %d\n", cmDist); // Display distance
  16. pause(200); // Wait 1/5 second
  17. }
  18. else if (PIR == 0)
  19. {
  20. pause(200);
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement