From 5c33efe58da97d1277f8615ef750c0695497c0b9 Mon Sep 17 00:00:00 2001 From: sicarius Date: Tue, 13 Feb 2007 19:10:02 +0000 Subject: Code-Work @ lowlevel --- source/AVR_Studio/Soccer/sensor/ballsensor.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'source/AVR_Studio/Soccer/sensor/ballsensor.c') diff --git a/source/AVR_Studio/Soccer/sensor/ballsensor.c b/source/AVR_Studio/Soccer/sensor/ballsensor.c index bf97f99..af9434b 100755 --- a/source/AVR_Studio/Soccer/sensor/ballsensor.c +++ b/source/AVR_Studio/Soccer/sensor/ballsensor.c @@ -1,11 +1,35 @@ #include "ballsensor.h" -Ballsensor::Ballsensor() { +Ballsensor::Ballsensor() { + // Umrechnungstabelle position i in Winkel + winkel[0] = 0; + winkel[1] = 30; + winkel[2] = 60; + winkel[3] = 100; + winkel[4] = 180; + winkel[5] = 260; + winkel[6] = 300; + winkel[7] = 330; } Ballsensor::~Ballsensor() { } int Ballsensor::getBallwinkel() { - return 0; + // Erstelle ein Array für die Sensorwerte + int sensor[NUM_BALLSENSOR]; + int result = 0; // und einer Variable fürs Ergebnis + int current = 1024; // Setze aktuellen Wert auf Maximum + + // Analoge Sensoren abfragen und eintragen + for(int i=0;i