/* Created: 4th May 2018 5:21 PM Author : Arif Motion Sensor Alarm Verion 4: */ // ATTINY13 pinout (partly) // RESET PB5 ===|1 P 8|=== VCC // PB3 ===|2 I 7|=== PB2 // PB4 ===|3 N 6|=== PB1 // GND ===|4 S 5|=== PB0 #define F_CPU 1200000 // 1.2 Mhz default attiny13a // for ease of coding #define Triggered 1 #define NotTriggered 0 #define SensorHigh PINB&(1< #include #include // Global Variables // volatile unsigned long millis = 0; unsigned long previousMillis =0; const uint8_t buzzer = 3; /* Alarm Pin */ const uint8_t SensorPin = 4; /* Sensor Pins */ // FUNCTIONS void timerSetup (); void buzzing(); // Main Loop // int main(void) { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// // SETUP //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// // RESET INTERRUPTS // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // cli(); // clear interrupts for safety // Set External Interrupt, must have to set i bit for interrupt library sei(); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Initialize timer timerSetup (); // Pin Directions DDRB |= (1<=2){ //PORTB |= (1<