Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "simpletools.h" // Include simpletools header
- #include "ping.h" // Include ping header
- int main() // main function
- {
- print("Warming up...");
- pause(20000);
- while(1) // Repeat indefinitely
- {
- int PIR = input(14);
- print("PIR = %d\n", PIR);
- if(PIR == 1)
- {
- int cmDist = ping_cm(15); // Get cm distance from Ping)))
- print("cmDist = %d\n", cmDist); // Display distance
- pause(200); // Wait 1/5 second
- }
- else if (PIR == 0)
- {
- pause(200);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement