write a c program to implement the following pseudo code see photo please Emphas
ID: 671245 • Letter: W
Question
write a c program to implement the following pseudo code see photo please Emphasis Heading tructions: Write a C program to implement the following pseudo code: /l make motor 1 go forward, then stop after 2 second ll make motor 1 go backward, then stop after 4 seconds /l make motor 1 stop (it should already be stopped at this point) HINTS You may need the following commands in your program: sleep (seconds.); Having trouble remember how to use commands? Read the class slides on the website: http://www.seas.gwu.edu/-ece001 Or look under the "useful links" on the website and read the "How to write a simple interac Program Parts 1 and 2 Requirements: 1. Program must have comments at thc begiuning desertbing overallfnction of prog 2. Program must have comments describing what each line does. 3. Program beginning describing overall function of prog must be submitted on paper at the beginning of the next lab & must be legible. 4. In addition to your paper copy, ensure that you have an electronic form of your program (e.g.- on a diskette, send it to yourself in an email), for use during next weeks clas 8 3 4 9Explanation / Answer
void main()
{
/* start motors forward */
fd(1);
/*wait for 2 seconds */
sleep(2.0);
/* turn off motors*/
off(1);
/* back motors */
bk(1);
/*wait for 4 seconds */
sleep(4.0);
/* turn off motors*/
off(1);
/* stop motors */
if(ao(1))
stop();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.