A program that allows control of the RenBuggy by altering the relative speeds of the wheels.

Dependencies:   mbed-renbed

Committer:
RenBuggy
Date:
Wed Apr 13 12:55:47 2016 +0000
Revision:
6:ce9b3fbdd856
Parent:
3:c12fbf373785
updated

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RenBuggy 0:9870f526ddd1 1 /*********************************************************
RenBuggy 0:9870f526ddd1 2 *RenBuggyTimed *
RenBuggy 0:9870f526ddd1 3 *Author: Elijah Orr *
RenBuggy 0:9870f526ddd1 4 * *
RenBuggy 0:9870f526ddd1 5 *This program demonstates use of a library of functions *
RenBuggy 0:9870f526ddd1 6 *(TimedMovement) to control the movement of the RenBuggy.*
RenBuggy 0:9870f526ddd1 7 * *
RenBuggy 0:9870f526ddd1 8 *********************************************************/
RenBuggy 0:9870f526ddd1 9
RenBuggy 3:c12fbf373785 10 /* mbed is a library made by mbed.org that contains
RenBuggy 0:9870f526ddd1 11 classes/functions designed to make programming mbed
RenBuggy 0:9870f526ddd1 12 microcontrollers easier */
RenBuggy 0:9870f526ddd1 13 #include "mbed.h"
RenBuggy 0:9870f526ddd1 14 /* #include tells the compiler to include TimedMovement.h
RenBuggy 0:9870f526ddd1 15 and TimedMovement.cpp in the program */
RenBuggy 0:9870f526ddd1 16 #include "TimedMovement.h"
RenBuggy 0:9870f526ddd1 17
RenBuggy 0:9870f526ddd1 18 /* the main function is where a program will begin to execute. */
RenBuggy 0:9870f526ddd1 19
RenBuggy 0:9870f526ddd1 20 /****************************************************************
RenBuggy 0:9870f526ddd1 21 * Function: main() *
RenBuggy 0:9870f526ddd1 22 * *
RenBuggy 0:9870f526ddd1 23 * Controls the movement of the RenBuggy by varying the speed *
RenBuggy 0:9870f526ddd1 24 * of each motor *
RenBuggy 0:9870f526ddd1 25 * *
RenBuggy 0:9870f526ddd1 26 * Inputs: none *
RenBuggy 0:9870f526ddd1 27 * *
RenBuggy 0:9870f526ddd1 28 * Returns: none *
RenBuggy 0:9870f526ddd1 29 ****************************************************************/
RenBuggy 0:9870f526ddd1 30 int main()
RenBuggy 0:9870f526ddd1 31 {
RenBuggy 0:9870f526ddd1 32 /* here we can call the functions defined in TimedMovement.h
RenBuggy 0:9870f526ddd1 33 and TimedMovement.cpp, and specify the length of time we want
RenBuggy 0:9870f526ddd1 34 them to run for by passing a variable which represents a
RenBuggy 0:9870f526ddd1 35 length of time in seconds */
RenBuggy 0:9870f526ddd1 36 forward(5);
RenBuggy 1:dd956fbd7e95 37 left(3);
RenBuggy 1:dd956fbd7e95 38 forward(2);
RenBuggy 1:dd956fbd7e95 39 wait(3);
RenBuggy 1:dd956fbd7e95 40 right(3);
RenBuggy 1:dd956fbd7e95 41 forward(6);
RenBuggy 0:9870f526ddd1 42 }