Hab das mal ausprobiert. Es kamen immer die richtigen Werte.
Hab jetzt mal noch weiter mit dem Programm probiert. Dabei ist folgendes Programm rausgekommen und es funktioniert soger![]()
Könnte mir vielleicht mal jemand das Blockschaltbild des AVR Prozessors erklären? (Ist das aus der ASURO-Anleitung)Code:#include "asuro.h" int main (void) { unsigned int data[2], i; unsigned char b1, b2; int speed; Init(); speed = 160; FrontLED(ON); MotorDir(FWD,FWD); MotorSpeed(speed,speed); while (1){ b1 = PollSwitch(); b2 = PollSwitch(); if (b1 == 0 && b2 == 0){ LineData(data); if ((data [0] < 20) && (data [1] > 20 )){ MotorDir(RWD,FWD); MotorSpeed(0,speed); BackLED(OFF,ON); StatusLED(RED); } if ((data [1] < 20) && (data [0] > 20 )){ MotorDir(FWD,RWD); MotorSpeed(speed,0); BackLED(ON,OFF); StatusLED(RED); } if ((data [1] < 20) && (data [0] < 20 )){ MotorDir(FWD,FWD); MotorSpeed(speed,speed); BackLED(ON,ON); StatusLED(GREEN); } } else if (b1 && b2 && b1 == b2){ while(1){ b1 = PollSwitch(); b2 = PollSwitch(); if (b1 == 0 && b2 == 0){ MotorDir(FWD,FWD); MotorSpeed(255,255); BackLED(OFF,OFF); StatusLED(GREEN); } else if (b1 && b2 && b1 == b2){ MotorDir(BREAK,BREAK); MotorDir(RWD,RWD); MotorSpeed(255,100); BackLED(OFF,ON); StatusLED(RED); for (i=0;i<200;i++){Sleep(255);} }} } } return 0; }
Danke







Zitieren

Lesezeichen