--- /dev/null
+volatile bool change_detected = false;
+
+void setup()
+{
+ // put your setup code here, to run once:
+ DDRC &= ~((1 << DDC0) | (1 << DDC1) | (1 << DDC2) | (1 << DDC3));
+ PORTC |= (1 << DDC0) | (1 << DDC1) | (1 << DDC2) | (1 << DDC3);
+ PCMSK1 |= (1 << PCINT8) | (1 << PCINT9) | (1 << PCINT10) | (1 << PCINT11);
+ PCICR |= (1 << PCIE1);
+ Serial.begin(38400, SERIAL_8E2);
+}
+
+void loop()
+{
+ if (change_detected)
+ {
+ delay(100);
+ Serial.print("Switch changed: ");
+ Serial.println(PINC & ((1 << PINC0) | (1 << PINC1) | (1 << PINC2) | (1 << PINC3)), BIN);
+ change_detected = false;
+ }
+}
+
+ISR(PCINT1_vect)
+{
+ change_detected = true;
+}