The system diagnostic prototype is designed, so that there is a way for users to debug UMobility when there are system malfunctions. In the event that Version 2.0 stops working, the user should turn off the device, and access the source code of Version 2.0.
The user should comment the operation code in the main loop, then visit test section in the main loop. Uncomment only one of the following test methods at a time, upload the code on the microcontroller, then run the code with the Arduino cable attached to a computer. Disconnect the battery plug as well during this time to conserve battery.
The buzzerTest() tests if the buzzer works by activating the buzzer. The joystickTest() method outputs the raw values of x and y axis to see if the joystick values travel the range of 0-1023. The abilitySwitchTest() method only prints “FORWARD”, “BACKWARD”, “LEFT”, and “RIGHT” on the serial monitor when the ability switches are pressed. If all switches print their respective movements correctly, the ability switches work.
The abilitySwitchDriveTest() and joystickDriveTest() methods print out the PWM signals based on the movement triggered by the user. These methods do not send signals to the motor controller. If there PWM signals output correspond to the globally predefined PULSE constants, the tested drive feature should work when the main operational code is uncommented back.
The front and back ultrasonic sensor tests simply output the detected distances of the sensors.
The gyroTest() method if the gyroscope pins are connected properly. If they are not, the serial monitor will let the user know that they are not.
If any of the test fail, the respective component’s cable and its connections to and on the breakout board should be checked.