summaryrefslogtreecommitdiffstats
path: root/source/AVR_Studio/Soccer/sensor/abstand.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/AVR_Studio/Soccer/sensor/abstand.c')
-rwxr-xr-xsource/AVR_Studio/Soccer/sensor/abstand.c24
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];
+}