#include <avr/interrupt.h>
#include <avr/sleep.h>
volatile int risingEdge = 0;
void setup() {
cli(); // Clear global interrupt
DDRD |= B01000000; // Set Pin 6 as output
DDRD &= B01111111; // Set Pin 7 as input
DDRB &= B111110; // Set Pin 8 as input
// Enabling both the PCINT0 and PCINT2 to activate
PCICR |= B00000101;
PCMSK0 |= B00000001; // Mask for Pin 8
PCMSK2 |= B10000000; // Mask for Pin 7
sei();
// Set the appropriate sleep mode
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
}
ISR(PCINT0_vect) {
// Toggle the LED in Pin 6
PORTD ^= B01000000;
}
ISR(PCINT2_vect) {
// Toggle the LED in Pin 6
PORTD ^= B01000000;
}
void loop() {
// Serial.println(value); // Used mainly for debugging
sleep_mode();
}