Ein kleines Beispiel, hier wird die StatusLED mit der Raddrehung geschaltet:

Code:
#include "../inc/asuro.h"
#include "../inc/asuro.c"

/* Pegel fuer low und high */
/* (mein asuro hat grad keine Abdeckungen ueber den Sensoren) */
#define schwelle0 400
#define schwelle1 600

int main(void) {
unsigned int odo_data[2];
unsigned char odo_status[2];


Init();
/* Vorsichtshalber erst eine Dummy-Messung */
OdometrieData(odo_data);
OdometrieData(odo_data);
/* Startwerte setzen*/
odo_status[0] = odo_data[0] > (schwelle0+schwelle1)/2;
odo_status[1] = odo_data[1] > (schwelle0+schwelle1)/2;

do{
	OdometrieData(odo_data);
	if ((odo_status[0]) && (odo_data[0] < schwelle0)) {
		odo_status[0] = !odo_status[0];
		StatusLED(OFF);
	}
	if ((!odo_status[0]) && (odo_data[0] > schwelle1)) {
		odo_status[0] = !odo_status[0];
		StatusLED(RED);
	}
	if ((odo_status[1]) && (odo_data[1] < schwelle0)) {
		odo_status[1] = !odo_status[1];
		StatusLED(OFF);
	}
	if ((!odo_status[1]) && (odo_data[1] > schwelle1)) {
		odo_status[1] = !odo_status[1];
		StatusLED(YELLOW);
	}

}while (1);
return 0;
}
Nur als Anregung, viele Wege führen hier zum Ziel. Ich hoffe, diesmal funzt es auf Anhieb...

Gruß

mic