RenBuggyTimed with edited function and access to seven segment display
Dependencies: SevenSegmentDisplay mbed
Fork of 1-RenBuggyTimed by
main.cpp@1:91ca3ea0f578, 2016-04-13 (annotated)
- Committer:
- DanArgust
- Date:
- Wed Apr 13 07:04:28 2016 +0000
- Revision:
- 1:91ca3ea0f578
- Parent:
- 0:9870f526ddd1
Release 0.0.1 1-RenBuggyTimed with changes all functions and including access to Seven Segment Display
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RenBuggy | 0:9870f526ddd1 | 1 | /********************************************************* |
RenBuggy | 0:9870f526ddd1 | 2 | *RenBuggyTimed * |
DanArgust | 1:91ca3ea0f578 | 3 | *Author: Dan Argust * |
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 | 0:9870f526ddd1 | 10 | /* mbed.h 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 */ |
DanArgust | 1:91ca3ea0f578 | 36 | forward(5.5); |
DanArgust | 1:91ca3ea0f578 | 37 | hold(16); |
DanArgust | 1:91ca3ea0f578 | 38 | readButton(11); |
DanArgust | 1:91ca3ea0f578 | 39 | forward(3); |
RenBuggy | 0:9870f526ddd1 | 40 | left(2); |
DanArgust | 1:91ca3ea0f578 | 41 | right(6.5); |
DanArgust | 1:91ca3ea0f578 | 42 | forward(3); |
DanArgust | 1:91ca3ea0f578 | 43 | hold(5); |
DanArgust | 1:91ca3ea0f578 | 44 | |
DanArgust | 1:91ca3ea0f578 | 45 | right(0.25); |
DanArgust | 1:91ca3ea0f578 | 46 | for (int i = 0;i<6;i++) |
DanArgust | 1:91ca3ea0f578 | 47 | { |
DanArgust | 1:91ca3ea0f578 | 48 | left(0.5); |
DanArgust | 1:91ca3ea0f578 | 49 | right(0.5); |
DanArgust | 1:91ca3ea0f578 | 50 | } |
DanArgust | 1:91ca3ea0f578 | 51 | left(0.25); |
DanArgust | 1:91ca3ea0f578 | 52 | forward(1.0); |
DanArgust | 1:91ca3ea0f578 | 53 | |
DanArgust | 1:91ca3ea0f578 | 54 | } |