 int horiz, vert;
 volatile int running;
 
+// Battery measurement settings
+// R1/R2 is the voltage divisor in Ω (GND-R1-A0-R2-Vcc)
+// actual measured values will yield a more accurate voltage
+#define BATT_R1 9980
+#define BATT_R2 46500
+#if defined(__AVR__)
+#define VCC 5000
+#else
+#define VCC 3300
+#endif
+#define BATT_RANGE (VCC * (BATT_R1 + BATT_R2) / BATT_R1)
 
 void setup() {
     Serial.begin(38400);
+
+    pinMode(REMOTE_IN, INPUT_PULLUP);
+    pinMode(COMPASS_DRDY, INPUT_PULLUP);
+    pinMode(MPU_INT, INPUT_PULLUP);
+
+    pinMode(BATTERY, INPUT);
+    analogReadRes(10);
+    analogReadAveraging(32);
 
     horiz_motor.setMicrostep(32);
     vert_motor.setMicrostep(32);

    Serial.println(F("Ready\n"));
}

/*
 * Display current panorama status (photo index, etc)
 */

#define CAMERA_FOCUS 0
#define CAMERA_SHUTTER 1

#define BATTERY A0

#define JOYSTICK_X A3
#define JOYSTICK_Y A2
#define JOYSTICK_SW 2

#define REMOTE_IN 3
#define COMPASS_DRDY 4
#define MPU_INT 7

#define MOTOR_STEPS 200
#define MOTORS_ON 13
