Final project – motor control program
To demonstrate all the concepts we have covered so far, let's build a motor control program. The program will simulate five motors. The motors will be in an array and the program will set the speed of the motors based on a persistent variable. To begin, let us create a motor structure:
TYPE motorStruct : STRUCT motorStateMsg : STRING[20]; motorState : BOOL; motorSpeed : INT; END_STRUCT END_TYPE
This code will create a structure that will dictate whether the motor is on with a Boolean variable, the motor speed (which will be set with an enum value), and a string that will tell which state the motor is in. After this structure is created, add an enum named motorSpeeds
. Once you create the enum, add the code to match the snippet:
{attribute 'qualified_only'} {attribute 'strict&apos...