diff options
Diffstat (limited to 'source/AVR_Studio/Soccer/sensor/abstand.c')
-rwxr-xr-x | source/AVR_Studio/Soccer/sensor/abstand.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/AVR_Studio/Soccer/sensor/abstand.c b/source/AVR_Studio/Soccer/sensor/abstand.c new file mode 100755 index 0000000..5acdcaf --- /dev/null +++ b/source/AVR_Studio/Soccer/sensor/abstand.c @@ -0,0 +1,24 @@ +#include "abstand.h"
+
+Abstand::Abstand() {
+ abstand[0] = ABSTAND_FEHLER;
+ abstand[1] = ABSTAND_FEHLER;
+ abstand[2] = ABSTAND_FEHLER;
+ abstand[3] = ABSTAND_FEHLER;
+}
+
+Abstand::~Abstand() {
+}
+
+void Abstand::Aktualisieren() {
+ // Gehe alle 4 Sensoren durch
+ for(int i=0;i<4;i++) {
+ abstand[i] = board.GetAbstand(i); // Und übernehme die Werte direkt vom Sensor
+ }
+}
+
+int Abstand::GetAbstand(int i) {
+ if((i < 0) || (i > 3)) return ABSTAND_FEHLER; //angebote rausfiltern ;)
+
+ return abstand[i];
+}
|