       new_value--;
     }
   }
+  // If bit 4, update the value with a coarse resolution
+  if (bitRead(changes, 4)) {
+    if (bitRead(state, 4) ^ bitRead(old_state, 5)) {
+      new_value += 8;
+    } else {
+      new_value -= 8;
+    }
+  }
+
   // Store the state to compare against next time
   old_state = state;
 }

  digitalWrite(2, HIGH);
  pinMode(3, INPUT);
  digitalWrite(3, HIGH);

  noInterrupts();
  // Pin change interrupt control register
  PCICR |= 0b100;
  
  // Pin change mask registers decide which pins are enabled as triggers
  PCMSK2 |= (_BV(PCINT18) | _BV(PCINT19));
  interrupts();
}


volatile int old_state = 0;
volatile int state = 0;

// Value to send to DAC
volatile int value = 0;
volatile int new_value = 500;

