ich habe es in einem verzeichnis ausgepackt, AVR studio startet brav, ich bin mir aber nicht sicher welches "example_*.c" file ich durch die eigene *.c datei ersetzen soll?
habe nun als DAU folgendes gemacht:
projektdatei umbenannt in "linie_hermann_sw_1.aps"
verzeichnis umbenannt in "linie_hermann_sw_1"
ursprüngliche datei "linie_hermann_sw.c" reinkopiert und in "linie_hermann_sw_1.c" umbenannt
projekteinstellungen ergänztCode:// // Program used by "myIrAsuro" in qualifying for competition // "Parallel Slalom" of RobotChallenge 2007 in Vienna (24th march): // http://www.robotchallenge.at // // Time 10.1s for 354cm, that is speed 35.05cm/s (best was 60.00 cm/s). // // myIrAsuro has reduction of 1:12.5 (Asuro standard is 1:25), see: // https://www.roboternetz.de/phpBB2/ze...ag.php?t=28876 // // The entries 0xFF for both SPEED values below will work on // a standard Asuro with speed < 0.5m/s. // // The value for THRESHOLD must be changed if no IR-FrontLED // with white shield is used, see: // https://www.roboternetz.de/phpBB2/ze...ag.php?t=29109 // // // Robot will have to be placed on the line for starting! // // After starting the StatusLED of Asuro will blink [ready]. // After (any) switch is pressed both BackLED's turn on [steady]. // Releasing the switch will start the Robot [go]. // #include <asuro.h> #define OFF_LEFT -1 #define ON_LINE 0 #define OFF_RIGHT +1 #define SPEED 0xbF // 0xFF //0xdF #define SPEED1 0xaF // 0xFF //0xbF #define SPEED2 0x00 #define THRESHOLD 1600 void RaceStart(void); // blink until any switch is pressed, // then wait until switch is released int main(void) { unsigned int sum,data[2]; int position = ON_LINE; Init(); RaceStart(); FrontLED(ON); MotorDir(FWD,FWD); MotorSpeed(SPEED,SPEED); while (1) // state machine: position on/off the line { LineData(data); sum = data[LEFT] + data[RIGHT]; if (sum>=THRESHOLD) // not on the line { if (position==ON_LINE) // switch state if previously on the line { position = (data[LEFT]<data[RIGHT]) ? OFF_RIGHT : OFF_LEFT; BackLED( (position==OFF_LEFT)?ON:OFF, (position==OFF_RIGHT)?ON:OFF ); } } else if (sum<THRESHOLD) // on the line { if (position!=ON_LINE) // switch state if previously not on the line { position = ON_LINE; BackLED(OFF,OFF); } } if (position==ON_LINE) { MotorSpeed(SPEED,SPEED); } // full FWD else if (position==OFF_RIGHT) { MotorSpeed(SPEED2,SPEED1); } // turn left else if (position==OFF_LEFT) { MotorSpeed(SPEED1,SPEED2); } // turn right } while (1); // code unreachable return 0; } void RaceStart(void) // blink until any switch is pressed, { // then wait until switch is released uint8_t t1, t2; unsigned int col=OFF; while (1) // blinking StatusLED until any switch is pressed { t1 = PollSwitch(); t2 = PollSwitch(); if (t1==t2) { if (t1) { break; } else { col ^= GREEN; StatusLED(col); } } Msleep(50); } StatusLED(OFF); // turn off StatusLED and ... BackLED(ON,ON); // ... turn on both BackLED's while (1) // wait until switch is released { t1 = PollSwitch(); t2 = PollSwitch(); if (t1==t2) { if (!t1) { break; } } Msleep(50); } BackLED(OFF,OFF); // turn off BackLED's indication start of race }
- frequenz 8000000, -Os
abgespeichert.
Beim kompilieren werden erstmal alle quelldateien von "asuro.c" bis zu "linie_hermann_sw_1.c" mit grünem punkt abgehakt.
dann komt folgendes:
ich dachte es war so gedacht, dass ich mit der RC3 und diesem filepack alle alten *.c dateien neu kompilieren kann? Habe ich da was falsch verstanden? Oder anderen fehler gemacht?Code:../linie_herman_sw_1.c:47: warning: implicit declaration of function `Init' ../linie_herman_sw_1.c:51: warning: implicit declaration of function `FrontLED' ../linie_herman_sw_1.c:51: error: `ON' undeclared (first use in this function) ../linie_herman_sw_1.c:51: error: (Each undeclared identifier is reported only once ../linie_herman_sw_1.c:51: error: for each function it appears in.) ../linie_herman_sw_1.c:52: warning: implicit declaration of function `MotorDir' ../linie_herman_sw_1.c:52: error: `FWD' undeclared (first use in this function) ../linie_herman_sw_1.c:53: warning: implicit declaration of function `MotorSpeed' ../linie_herman_sw_1.c:57: warning: implicit declaration of function `LineData' ../linie_herman_sw_1.c:58: error: `LEFT' undeclared (first use in this function) ../linie_herman_sw_1.c:58: error: `RIGHT' undeclared (first use in this function) ../linie_herman_sw_1.c:67: warning: implicit declaration of function `BackLED' ../linie_herman_sw_1.c:67: error: `OFF' undeclared (first use in this function) ../linie_herman_sw_1.c: In function `RaceStart': ../linie_herman_sw_1.c:95: error: `uint8_t' undeclared (first use in this function) ../linie_herman_sw_1.c:95: error: syntax error before "t1" ../linie_herman_sw_1.c:96: error: `OFF' undeclared (first use in this function) ../linie_herman_sw_1.c:100: error: `t1' undeclared (first use in this function) ../linie_herman_sw_1.c:100: warning: implicit declaration of function `PollSwitch' ../linie_herman_sw_1.c:101: error: `t2' undeclared (first use in this function) ../linie_herman_sw_1.c:110: error: `GREEN' undeclared (first use in this function) ../linie_herman_sw_1.c:111: warning: implicit declaration of function `StatusLED' ../linie_herman_sw_1.c:114: warning: implicit declaration of function `Msleep' ../linie_herman_sw_1.c:118: error: `ON' undeclared (first use in this function) make: *** [linie_herman_sw_1.o] Error 1 Build failed with 14 errors and 9 warnings...






Zitieren

Lesezeichen