I have code that compiles correctly for an ATTINY85 board using the ARDUINO IDE but I don't have an ATTINY85 board. I have an Arduino Mega ATMEGA2560 and when I select this board in the Arduino IDE the code does not compile and throws this error message
sketch_feb21a:216:3: error: 'GIMSK' was not declared in this scope
GIMSK |= _BV(PCIE); // Enable Pin Change Interrupts
^
sketch_feb21a:216:16: error: 'PCIE' was not declared in this scope
GIMSK |= _BV(PCIE); // Enable Pin Change Interrupts
^
sketch_feb21a:217:3: error: 'PCMSK' was not declared in this scope
PCMSK |= _BV(PCINT2); // Use PB3 as interrupt pin
^
exit status 1
'GIMSK' was not declared in this scope
Here is the code snippet that throws the error
void sleep()
{
GIMSK |= _BV(PCIE); // Enable Pin Change Interrupts
PCMSK |= _BV(PCINT2); // Use PB3 as interrupt pin
ADCSRA &= ~_BV(ADEN); // ADC off
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // replaces above statement
MCUCR &= ~_BV(ISC01);
MCUCR &= ~_BV(ISC00); // Interrupt on rising edge
sleep_enable(); // Sets the Sleep Enable bit in the MCUCR Register (SE BIT)
sei(); // Enable interrupts
sleep_cpu(); // sleep
cli(); // Disable interrupts
PCMSK &= ~_BV(PCINT2); // Turn off PB3 as interrupt pin
sleep_disable(); // Clear SE bit
ADCSRA |= _BV(ADEN); // ADC on
sei(); // Enable interrupts
}
ISR(PCINT0_vect) {
/*noInterrupts();
while (digitalRead(BUTTON_PIN) == LOW);
delay(50);
while (digitalRead(BUTTON_PIN) == LOW);
playTrack(1 + (curTrack++ % 2));
delay(400);
interrupts();*/
}