Updated controller.py with new code from Ben, added hardware_reset() call before any initialisation.