Basic RenBuggy program - Start here with RenBuggy

Dependencies:   SevenSegmentDisplay mbed

Fork of Renbed_Buggy_Basics by Miskin Project

Committer:
MiskinPrj
Date:
Thu Apr 21 14:42:35 2016 +0000
Revision:
3:152595d33544
Parent:
0:23373ebd6d3a
stop and hold at start of main

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MiskinPrj 0:23373ebd6d3a 1 /*********************************************************
MiskinPrj 0:23373ebd6d3a 2 *buggy_functions.h *
MiskinPrj 0:23373ebd6d3a 3 *Author: Elijah Orr & Dan Argust *
MiskinPrj 0:23373ebd6d3a 4 * *
MiskinPrj 0:23373ebd6d3a 5 *A library of functions that can be used to control the *
MiskinPrj 0:23373ebd6d3a 6 *RenBuggy. *
MiskinPrj 0:23373ebd6d3a 7 *********************************************************/
MiskinPrj 0:23373ebd6d3a 8
MiskinPrj 0:23373ebd6d3a 9 /* include guards are used to prevent problems caused by
MiskinPrj 0:23373ebd6d3a 10 multiple definitions */
MiskinPrj 0:23373ebd6d3a 11 #ifndef BUGGY_FUNCTIONS_H
MiskinPrj 0:23373ebd6d3a 12 #define BUGGY_FUNCTIONS_H
MiskinPrj 0:23373ebd6d3a 13
MiskinPrj 0:23373ebd6d3a 14 /* mbed.h must be included in this file also */
MiskinPrj 0:23373ebd6d3a 15 #include "mbed.h"
MiskinPrj 0:23373ebd6d3a 16
MiskinPrj 0:23373ebd6d3a 17 /* #define LeftMotorPin p5 tells the preprocessor to replace
MiskinPrj 0:23373ebd6d3a 18 any mention of LeftMotorPin with p5 etc. */
MiskinPrj 0:23373ebd6d3a 19 #define LeftMotorPin p5
MiskinPrj 0:23373ebd6d3a 20 #define RightMotorPin p6
MiskinPrj 0:23373ebd6d3a 21
MiskinPrj 0:23373ebd6d3a 22 /* these are function prototypes that declare all the functions
MiskinPrj 0:23373ebd6d3a 23 in the library.*/
MiskinPrj 0:23373ebd6d3a 24 extern void forward(float); //Move the buggy forward for (float) seconds
MiskinPrj 0:23373ebd6d3a 25 extern void left(float); //Turn left for (float) seconds
MiskinPrj 0:23373ebd6d3a 26 extern void right(float); //Turn right for (float) seconds
MiskinPrj 0:23373ebd6d3a 27 extern void hold(float); //Hold the buggy in an idle state for (float) seconds
MiskinPrj 0:23373ebd6d3a 28 extern void stop(); //Stop all motors
MiskinPrj 0:23373ebd6d3a 29
MiskinPrj 0:23373ebd6d3a 30 extern void readButton(float); //Similar to hold, but scans for button presses while waiting
MiskinPrj 0:23373ebd6d3a 31 extern int rollDice(); //Randomly generate a number a display it on the seven segment display
MiskinPrj 0:23373ebd6d3a 32
MiskinPrj 0:23373ebd6d3a 33 /* stop() and rollDice() do not need to be giving a float
MiskinPrj 0:23373ebd6d3a 34 to be run unlike the other functions which use a (float)
MiskinPrj 0:23373ebd6d3a 35 to know how long they should run for */
MiskinPrj 0:23373ebd6d3a 36
MiskinPrj 0:23373ebd6d3a 37 #endif // BUGGY_FUNCTIONS_H