Basic buggy functions with seven segment readout

Dependencies:   SevenSegmentDisplay mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers buggy_functions.h Source File

buggy_functions.h

00001 /*********************************************************
00002 *buggy_functions.h                                       *
00003 *Author: Elijah Orr & Dan Argust                         *
00004 *                                                        *
00005 *A library of functions that can be used to control the  *
00006 *RenBuggy.                                               *
00007 *********************************************************/
00008 
00009 /* include guards are used to prevent problems caused by 
00010 multiple definitions */
00011 #ifndef BUGGY_FUNCTIONS_H
00012 #define BUGGY_FUNCTIONS_H
00013 
00014 /* mbed.h must be included in this file also */
00015 #include "mbed.h"
00016 
00017 /* #define LeftMotorPin p5 tells the preprocessor to replace
00018 any mention of LeftMotorPin with p5 etc. */
00019 #define LeftMotorPin p5
00020 #define RightMotorPin p6
00021 
00022 /* these are function prototypes that declare all the functions
00023 in the library.*/
00024 extern void forward(float); //Move the buggy forward for (float) seconds
00025 extern void left(float); //Turn left for (float) seconds
00026 extern void right(float); //Turn right for (float) seconds
00027 extern void hold(float); //Hold the buggy in an idle state for (float) seconds
00028 extern void stop(); //Stop all motors
00029 
00030 extern void readButton(float); //Similar to hold, but scans for button presses while waiting
00031 extern int rollDice(); //Randomly generate a number a display it on the seven segment display
00032 
00033 /* stop() and rollDice() do not need to be giving a float
00034 to be run unlike the other functions which use a (float)
00035 to know how long they should run for */
00036 
00037 #endif // BUGGY_FUNCTIONS_H