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_V6 by
Diff: Regler.cpp
- Revision:
- 8:d0a27278c108
- Parent:
- 7:862d80e0ea2d
--- a/Regler.cpp Fri May 04 16:26:59 2018 +0000 +++ b/Regler.cpp Mon May 07 14:11:06 2018 +0000 @@ -13,9 +13,9 @@ using namespace std; -const float Regler :: PERIOD = 0.2f; +const float Regler :: PERIOD = 0.001f; const int Regler :: FIXSPEED = 50; -float faktor = 0.1; +float faktor = 0.12; @@ -32,7 +32,7 @@ } void Regler::setSpeed (){ - measR2 = iRSensor.readR(); // Converts and read the analog input value (value from 0.0 to 1.0) + measR2 = iRSensor.readR(); // Converts and read the analog input value measL2 = iRSensor.readL(); if((measR2 > 100) && (measL2 < 100)) { //keine Wnad rechts @@ -89,7 +89,7 @@ } if ((measR2 < measL2)&& (measL2 - measR2 > 3)) { //IR Sensor werte werden verglichen und die Korrektur wird berechnet div1 = measR2 - measL2; // An beiden seinen Wände - kor1 = 0.1f*div1; + kor1 = 0.12f*div1; div2 = 0; div3 = 0; div4 = 0; @@ -99,7 +99,7 @@ SpeedL = FIXSPEED + kor1; } else if ((measR2 > measL2) && (measR2 - measL2 >3)) { div2 = measL2 - measR2; - kor2 = 0.1f*div2; + kor2 = 0.12f*div2; div1 = 0; div3 = 0; div4 = 0;