RenBuggyTimed with edited function and access to seven segment display

Dependencies:   SevenSegmentDisplay mbed

Fork of 1-RenBuggyTimed by Ren Buggy

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*********************************************************
00002 *RenBuggyTimed                                           *
00003 *Author: Dan Argust                                      *
00004 *                                                        *  
00005 *This program demonstates use of a library of functions  *
00006 *(TimedMovement) to control the movement of the RenBuggy.*
00007 *                                                        *
00008 *********************************************************/
00009 
00010 /* mbed.h is a library made by mbed.org that contains 
00011 classes/functions designed to make programming mbed 
00012 microcontrollers easier */
00013 #include "mbed.h"
00014 /* #include tells the compiler to include TimedMovement.h
00015 and TimedMovement.cpp in the program */
00016 #include "TimedMovement.h" 
00017 
00018 /* the main function is where a program will begin to execute. */
00019 
00020 /****************************************************************
00021 * Function: main()                                              *
00022 *                                                               *
00023 * Controls the movement of the RenBuggy by varying the speed    *
00024 * of each motor                                                 *
00025 *                                                               *
00026 * Inputs: none                                                  *
00027 *                                                               *
00028 * Returns: none                                                 *
00029 ****************************************************************/
00030 int main()
00031 {
00032     /* here we can call the functions defined in TimedMovement.h
00033     and TimedMovement.cpp, and specify the length of time we want
00034     them to run for by passing a variable which represents a 
00035     length of time in seconds */
00036     forward(5.5);
00037     hold(16);
00038     readButton(11);
00039     forward(3);
00040     left(2);
00041     right(6.5);
00042     forward(3);
00043     hold(5);
00044     
00045     right(0.25);
00046     for (int i = 0;i<6;i++)
00047     {
00048         left(0.5);
00049         right(0.5);
00050     }
00051     left(0.25);
00052     forward(1.0);
00053     
00054 }