Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Roboshark_V62 by
Diff: main.cpp
- Revision:
- 7:862d80e0ea2d
- Parent:
- 6:7bbcdd07bc2d
- Child:
- 8:d0a27278c108
diff -r 7bbcdd07bc2d -r 862d80e0ea2d main.cpp
--- a/main.cpp Thu May 03 19:36:16 2018 +0000
+++ b/main.cpp Fri May 04 16:26:59 2018 +0000
@@ -1,4 +1,4 @@
-/*Roboshark V4
+/*Roboshark V5
main.cpp
Erstellt: J. Blunschi
geändert: V.Ahlers
@@ -51,6 +51,7 @@
int temp = 0;
float SpeedR = 0;
float SpeedL = 0;
+int reglerEin = 0;
//von main Vincent kopiert
DigitalOut enableMotorDriver(PB_2);
@@ -67,9 +68,9 @@
Controller controller(pwmLeft, pwmRight, counterLeft, counterRight);
-Regler regler(IrRight, IrLeft);
+Regler regler(IrRight, IrLeft, iRSensor);
-Fahren fahren(controller, counterLeft, counterRight, regler); //Reihenfolge!!!!!!!!!!!!!!!!!!! Ultra wichtig
+Fahren fahren(controller, counterLeft, counterRight, regler, reglerEin); //Reihenfolge!!!!!!!!!!!!!!!!!!! Ultra wichtig
int main()
{
@@ -107,7 +108,7 @@
- /* printf (" ende = %d\n",ende);
+ /* printf (" ende = %d\n",ende);
printf (" finish = %d\n",finish);
printf (" finishLast = %d\n",finishLast);
printf("line = %f\n", line);
@@ -136,25 +137,33 @@
} else {caseDrive = 0; // Folge; Stop
}
- //printf("caseDrive = %d\n",caseDrive);
+ printf("caseDrive = %d\n",caseDrive);
//printf("ende = %d\n",ende);
- wait (0.2);
+ wait (0.1);
if(caseDrive == 1){ // Aufrufen der verschiedenen fahr funktionen
+ reglerEin = 1;
fahren.geradeausG();
+ reglerEin = 0;
} else if (caseDrive == 2){
fahren.rechts90();
+ reglerEin = 1;
fahren.geradeausG();
+ reglerEin = 0;
} else if (caseDrive == 3){
fahren.links90();
+ reglerEin = 1;
fahren.geradeausG();
+ reglerEin = 0;
} else if (caseDrive == 4){
fahren.rechts180();
+ reglerEin = 1;
fahren.geradeausG();
+ reglerEin = 0;
} else if (caseDrive == 0){
fahren.stopp();
} else if(caseDrive == 5){
