Shift away from Arduino to C, updated definitions and timer usage.