Post mal den Fehler
Ich muss euch leider enttäuschen, denn es funktioniert nicht, weil es einen Fehler im Proramm gibt, nämlich, dass die Variable taste jetzt nicht mehr deklariert ist, weshalb er das Programm nicht kompiliert.
Als ich dann taste noch einmal als unsigned char deklariert hatte, wurde das Programm zwar kompiliert, aber der Asuro fuhr nur geradeaus.
Edit: Hey Core duo könnte es vielleicht wieder an return 0; liegen wie beim letzten mal?
Post mal den Fehler
Hier das Programm von core duo
Jetzt hier der FehlerCode:#include "asuro.h" int main(void){ Init(); int zeit; unsigned int taste1, taste2; MotorDir(FWD,FWD); MotorSpeed(120,124); StatusLED(GREEN); FrontLED(ON); while (1){ taste1=PollSwitch(); taste2=PollSwitch(); if(taste1 == taste2){ if (taste == 1){ MotorSpeed(0,0); StatusLED(RED); BackLED(ON,ON); MotorDir(RWD,RWD); MotorSpeed(150,151); for(zeit=0;zeit<1000;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(0,180); for (zeit=0; zeit<415; zeit++){ Sleep(72); } MotorSpeed(120,121); for(zeit=0;zeit<500;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(180,0); for (zeit=0; zeit<415; zeit++){ Sleep(72); } MotorSpeed(120,121); } else if (taste==32){ MotorSpeed(0,0); StatusLED(RED); BackLED(ON,ON); MotorDir(RWD,RWD); MotorSpeed(150,152); for(zeit=0;zeit<1000;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(180,0); for (zeit=0; zeit<415; zeit++){ Sleep(72); } MotorSpeed(120,122); for(zeit=0;zeit<500;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(0,180); for (zeit=0; zeit<415; zeit++){ Sleep(72); } MotorSpeed(120,122); } else if (taste==16 || taste==2){ MotorSpeed(0,0); StatusLED(RED); BackLED(ON,ON); MotorDir(RWD,RWD); MotorSpeed(150,152); for(zeit=0;zeit<1000;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(0,180); for (zeit=0; zeit<1000; zeit++){ Sleep(72); } MotorSpeed(120,122); } } } while(1); return 0; }
Code:avr-gcc -c -mmcu=atmega8 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c -o test.o In file included from asuro.h:34, from test.c:1: c:/winavr-20090313/lib/gcc/../../avr/include/avr/signal.h:36:2: warning: #warning "This header file is obsolete. Use <avr/interrupt.h>." test.c: In function 'main': test.c:18: error: 'taste' undeclared (first use in this function) test.c:18: error: (Each undeclared identifier is reported only once test.c:18: error: for each function it appears in.) make: *** [test.o] Error 1 > Process Exit Code: 2 > Time Taken: 00:01
also bei mir kommt da kein Fehler, hier ist die hex datei dazu
So sah das bei mir aus:
Und hier die Meldungen:Code:#include "asuro.h" int main(void){ Init(); int zeit; unsigned int taste1, taste2; MotorDir(FWD,FWD); MotorSpeed(120,124); StatusLED(GREEN); FrontLED(ON); while (1){ taste1=PollSwitch(); taste2=PollSwitch(); if(taste1 == taste2){ if (taste == 1){ MotorSpeed(0,0); StatusLED(RED); BackLED(ON,ON); MotorDir(RWD,RWD); MotorSpeed(150,151); for(zeit=0;zeit<1000;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(0,180); for (zeit=0; zeit<415; zeit++){ Sleep(72); } MotorSpeed(120,121); for(zeit=0;zeit<500;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(180,0); for (zeit=0; zeit<415; zeit++){ Sleep(72); } MotorSpeed(120,121); } else if (taste==32){ MotorSpeed(0,0); StatusLED(RED); BackLED(ON,ON); MotorDir(RWD,RWD); MotorSpeed(150,152); for(zeit=0;zeit<1000;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(180,0); for (zeit=0; zeit<415; zeit++){ Sleep(72); } MotorSpeed(120,122); for(zeit=0;zeit<500;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(0,180); for (zeit=0; zeit<415; zeit++){ Sleep(72); } MotorSpeed(120,122); } else if (taste==16 || taste==2){ MotorSpeed(0,0); StatusLED(RED); BackLED(ON,ON); MotorDir(RWD,RWD); MotorSpeed(150,152); for(zeit=0;zeit<1000;zeit++){ Sleep(72); } BackLED(OFF,OFF); StatusLED(GREEN); MotorDir(FWD,FWD); MotorSpeed(0,180); for (zeit=0; zeit<1000; zeit++){ Sleep(72); } MotorSpeed(120,122); } } } while(1); return 0; }
Code:C:\ASURO_src\FirstTry>make all -------- begin -------- avr-gcc --version avr-gcc (GCC) 3.3.1 Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Size before: test.elf : section size addr .text 4216 0 .data 16 8388704 .bss 1 8388720 .noinit 0 8388721 .eeprom 0 8454144 .stab 5772 0 .stabstr 2329 0 Total 12334 Size after: test.elf : section size addr .text 4216 0 .data 16 8388704 .bss 1 8388720 .noinit 0 8388721 .eeprom 0 8454144 .stab 5772 0 .stabstr 2329 0 Total 12334 Errors: none -------- end -------- > Process Exit Code: 0
Schick mir mal den Quellcode von deiner asuro.h und asuro.c Datei
Hat meine Hex funktioniert?!
Er ist kurz nach vorne gefahren und hat sich dann unendlich im Kreis gedreht.
Funktioniert auch mit deinen Dateien nicht.
war das zufälligerweiße immer nach links?
Was für lichtverhältnisse herschen bei dir?
Lesezeichen