![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
vf
Dependencies: Servo ServoArm mbed
Fork of PES_Official by
Diff: Sources/Farbsensor.cpp
- Revision:
- 13:6c1f8e35b242
- Parent:
- 12:c0bcb95885dd
diff -r c0bcb95885dd -r 6c1f8e35b242 Sources/Farbsensor.cpp --- a/Sources/Farbsensor.cpp Wed May 10 13:30:13 2017 +0000 +++ b/Sources/Farbsensor.cpp Wed May 10 16:53:01 2017 +0000 @@ -1,6 +1,6 @@ #include "Robot.h" #include "Declarations.h" - +Serial pc1(USBTX, USBRX); Farbsensor::Farbsensor() { @@ -19,17 +19,19 @@ int Farbsensor::read() { static int time=0; - static float Messungen=0.0f; + static float messungen=0.0f; if( time < 10 ){ - Messungen += FarbVoltage->read(); + messungen += FarbVoltage->read(); time++; return -1; } else{ + float Ufarbsensor = messungen/10.0; + Ufarbsensor = Ufarbsensor*3300;//Set the Voltage between 0mV und 3300mV + pc1.printf("measure = %.0f mV\n", Ufarbsensor); + + messungen = 0.0f; time = 0; - float Ufarbsensor = Messungen/10.0; - Ufarbsensor = Ufarbsensor*3300; //Set the Voltage between 0mV und 3300mV - if ((Ufarbsensor > GREEN_DOWNLIMIT) && (Ufarbsensor < GREEN_UPLIMIT)) { return GREEN;