June 2018
Beginner to intermediate
280 pages
6h 58m
English
The following code in Energia can be used to test the two motors in the differential drive configuration. This code can move the robot forward for 5 seconds and backward for 5 seconds. Then, it moves the robot to the left for 5 seconds and right for 5 seconds. After each movement, the robot will stop for 1 second.
At the start of the code, we define pins for INA, INB, and PWM of the two motors, as follows:
///Left Motor Pins #define INA_1 12 #define INB_1 13 #define PWM_1 PC_6 ///Right Motor Pins #define INA_2 5 #define INB_2 6 #define PWM_2 PC_5
The pinout for Launchpad is given at: http://energia.nu/pin-maps/guide_tm4c123launchpad/
The following code shows the five functions to move the robot forward, backward, left, ...