BULME_BERTL14
/
func_Bertl
Bertl Robot with fiunctions
Diff: main.cpp
- Revision:
- 6:be710baf53ec
- Parent:
- 5:7b091d085c70
- Child:
- 7:cb6947e1f1d3
--- a/main.cpp Thu Jan 15 10:18:16 2015 +0000 +++ b/main.cpp Thu Jan 22 13:44:59 2015 +0000 @@ -1,5 +1,5 @@ /*********************************** -* name: func_Bertl v 0.2 +* name: func_Bertl v 0.3 * author: PE HTL BULME * email: pe@bulme.at * description: @@ -9,6 +9,7 @@ #include "mbed.h" #include "config.h" +bool Start(); void ShutOff(); void Move(); bool FrontIsClear(); @@ -23,19 +24,23 @@ void MoveMore(int anzahl); void Back(); bool WaitUntilButtonPressed(); -bool Start(); + +// Eigene Funktionsdefinitionen hier + // ************* Hauptprogramm ************ int main() { - while(!Start()) {} // wait to start + // while(!Start()) {} // wait to start wait_ms(200); Move(); TurnLeft(); Move(); + TurnLeftTicks(2000); // Anzahl der MotorSensorwerte + ShutOff(); return 0; } @@ -102,14 +107,21 @@ return wert; } -bool MoveMeasure(int& left, int& right) +/* +use in main(): + int left=0, right=0; + + MoveMeasure(1000, left, right); + pc.printf("\r\nleft= %d right= %d\r\n", left, right); +*/ +bool MoveMeasure(int time, int& left, int& right) { int count=0; //, left=0, right=0; MotorR_EN=MotorL_EN=1; MotorR_FORWARD = MotorL_FORWARD = 1; - while(count<1000) { + while(count<time) { MotorR_FORWARD = MotorL_FORWARD = 1; LED_D10 = SensorL; if(SensorL == 1)