/* SERIAL_TERMINAL USED */ // ------ Libraries and Definitions ------ #include "simpletools.h" // ------ Global Variables and Objects ------ int pir; // ------ Function Declarations ------ void led2(); // ------ Main Program ------ int main() { // Wait 20 to 30 seconds for PIR to calibrate or"warm up" print("Wait about 5 seconds for PIR to calibrate..........."); print("\r"); pause(5000); term_cmd(CLS); // Once the PIR detects movement, it will send a HIGH or a value of 1 out from its OUTPUT pin while (1) { pir = input(5); if (pir == 1) { cog_run(led2, 128); while (1) { print("Intruder Alert!"); print("\r"); freqout(4, 500, 1000); term_cmd(CLS); pause(1000); } } } } // ------ Functions ------ void led2() { while (1) { high(2); pause(500); low(2); pause(500); } return 0; }