Do NOT modify!
Dependencies: mbed Servo ServoArm
Fork of PES_Yanick by
Diff: Sources/Farbsensor.cpp
- Revision:
- 10:f76476943a6c
- Parent:
- 4:67d7177c213f
- Child:
- 12:c0bcb95885dd
diff -r 6fed0dcae9c1 -r f76476943a6c Sources/Farbsensor.cpp --- a/Sources/Farbsensor.cpp Tue May 02 08:00:19 2017 +0000 +++ b/Sources/Farbsensor.cpp Wed May 03 13:54:51 2017 +0000 @@ -18,9 +18,14 @@ int Farbsensor::read() { - int farbe; - float Ufarbsensor=FarbVoltage->read(); - Ufarbsensor=Ufarbsensor*3300; //Set the Voltage between 0mV und 3300mV + int farbe; + float Messungen=0.0; + for(int i=0;i<10;i++){ + Messungen+=FarbVoltage->read(); + wait(0.2); + } + float Ufarbsensor = Messungen/10.0; + Ufarbsensor = Ufarbsensor*3300; //Set the Voltage between 0mV und 3300mV if ((Ufarbsensor > GREEN_DOWNLIMIT) && (Ufarbsensor < GREEN_UPLIMIT)) {