hallo ich habe dasselbe Problem und würde gerne mal genau wissen, was in den Einstellungen getan werden musste, um das Problem zu beheben.
hallo ich habe dasselbe Problem und würde gerne mal genau wissen, was in den Einstellungen getan werden musste, um das Problem zu beheben.
Hallo lfakner
Das ist etwas wenig Info - welches Problem hast Du? Poste doch mal die Fehlermeldungen. die der Compiler ausgibt, erst dann kann man gezielt helfen
mfg
Hero_123
ok, tschuldige.
../Nibo2.c: In function 'weicherechtsaus':
../Nibo2.c:17: warning: implicit declaration of function 'copro_setSpeed'
../Nibo2.c: In function 'rechtskurve':
../Nibo2.c:27: warning: implicit declaration of function 'copro_stop'
../Nibo2.c:29: warning: implicit declaration of function 'copro_setTargetRel'
../Nibo2.c: In function 'main':
../Nibo2.c:72: warning: implicit declaration of function 'spi_init'
../Nibo2.c:74: warning: implicit declaration of function 'sound_init'
../Nibo2.c:88: warning: implicit declaration of function 'copro_setSpeedParameters'
../Nibo2.c:89: warning: implicit declaration of function 'copro_ir_startMeasure'
../Nibo2.c:101: warning: implicit declaration of function 'copro_update'
../Nibo2.c:104: error: 'copro_distance' undeclared (first use in this function)
../Nibo2.c:104: error: (Each undeclared identifier is reported only once
../Nibo2.c:104: error: for each function it appears in.)
make: *** [Nibo2.o] Error 1
Build failed with 3 errors and 8 warnings...
#include <nibo/niboconfig.h>
#include <nibo/display.h>
#include <nibo/gfx.h>
#include <nibo/leds.h>
#include <nibo/delay.h>
#include <nibo/copro.h>
#include <nibo/iodefs.h>
#include <nibo/bot.h>
#include <nibo/pwm.h>
#include <nibo/sound.h>
#include <avr/interrupt.h>
#include <nibo/spi.h>
#include <stdio.h>
void weicherechtsaus(int speed)
{
copro_setSpeed(speed,speed/2); //linkes Rad langsamer drehen
}
void weichelinksaus(int speed)
{
copro_setSpeed(speed/2,speed); //linkes Rad langsamer drehen
}
void rechtskurve()
{
copro_stop();
delay(100);
copro_setTargetRel(27, -27, 10);
delay(2000);
}
void ZeigeZahl(int zahl, int ptit)
{
if(zahl<5)
{
leds_set_status(0,7-ptit); //aus
}
else if(zahl>50)
{
leds_set_status(2,7-ptit); //rot
}
else if ((zahl>=5)&&(zahl<20))
{
leds_set_status(1,7-ptit); //gr¸n
}
else if ((zahl>=20)&&(zahl<=50))
{
leds_set_status(3,7-ptit); //orange
}
}
int main(void)
{ // initialisierung
sei();
bot_init();
spi_init();
pwm_init();
sound_init();
display_init();
gfx_init();
leds_init();
gfx_move(15, 0);
gfx_set_proportional(1);
gfx_print_text("Distance sensor test");
gfx_set_proportional(0);
gfx_move(5, 10);
gfx_print_char('R');
gfx_move(118, 10);
gfx_print_char('L');
delay(50);
copro_setSpeedParameters(5,6,7);
copro_ir_startMeasure(); //Zaehler der IR-Sensoren (0..4)
int zahl;
int ptit;
int speed=20;
int sensitvity=25;
while(1)
{
delay(10);
char text[20]="-- -- -- -- --";
copro_setSpeed(speed,speed);
if (copro_update())
{
sprintf(text, "%2d %2d %2d %2d %2d",
copro_distance[0]/256,
copro_distance[1]/256,
copro_distance[2]/256,
copro_distance[3]/256,
copro_distance[4]/256);
if((copro_distance[3]/1000)>sensitvity) //Sensor mitte links
{
weicherechtsaus(speed);
}
if((copro_distance[4]/1000)>sensitvity) //Sensor links
{
weicherechtsaus(speed);
}
if((copro_distance[1]/1000)>sensitvity) //Sensor mitte rechts
{
weichelinksaus(speed);
}
if((copro_distance[0]/1000)>sensitvity) //Sensor rechts
{
weichelinksaus(speed);
}
if((copro_distance[2]/1000)>50) //Sensor mitte
{
rechtskurve();
}
if((copro_distance[1]/1000)>55&&(copro_distance[3]/1000)>55) //Sensoren mitte rechts und links
{
rechtskurve();
}
if((copro_distance[0]/1000)>55&&(copro_distance[4]/1000)>55) //Sensoren rechts und links
{
rechtskurve();
}
for(ptit=0; ptit<=4; ptit++)
{
zahl=copro_distance[ptit]/1000; // Skaliere auf 0-64;
ZeigeZahl(zahl, ptit);
}
}
gfx_move(10, 55);
gfx_print_text(text);
// Spannung
bot_update();
float volt = 0.0166 * bot_supply - 1.19;
sprintf(text, "%3.1fV", (double)volt);
gfx_move(30, 10);
gfx_set_proportional(1);
gfx_print_text("supply: ");
gfx_set_proportional(0);
gfx_print_text(text);
}
return(0);
}
Bitte
Hallo lfakner
Ich habe Dein Programm bei mir compiliert und es kamen keine Fehlermeldungen. Ich benutze AVRStudio 4.18 Build700.
Verwendest Du das AVRStudio zum Kompilieren? Wenn ja, sind Deine Suchpfadeinstellungen beim AVRStudio nicht korrekt => der Compiler findet die include-files und die lib-files nicht. Check mal die Einstellungen (siehe auch das Nibo2Tutorial*.pdf auf Seite 5ff).
mfg
Hero_123
ja es funktionieren auch alle Programme, die keine copro Befehle nutzten. Und die Libraries findet Avr, denn unter Configuration Options/Libraries werden alle notwendigen Objekte wie libnibo2.a usw. angezeigt.
=> "implicit declaration" heißt nichts anderes, als dass die Suchpfade nicht korrekt sind (bedeutet, daß eine Funktion "implizit" deklariert ist - und WO ist das in Deinem Programm??)../Nibo2.c: In function 'weicherechtsaus':
../Nibo2.c:17: warning: implicit declaration of function 'copro_setSpeed'
../Nibo2.c: In function 'rechtskurve':
../Nibo2.c:27: warning: implicit declaration of function 'copro_stop'
../Nibo2.c:29: warning: implicit declaration of function 'copro_setTargetRel'
../Nibo2.c: In function 'main':
../Nibo2.c:72: warning: implicit declaration of function 'spi_init'
../Nibo2.c:74: warning: implicit declaration of function 'sound_init'
../Nibo2.c:88: warning: implicit declaration of function 'copro_setSpeedParameters'
../Nibo2.c:89: warning: implicit declaration of function 'copro_ir_startMeasure'
../Nibo2.c:101: warning: implicit declaration of function 'copro_update'
kann nicht stimmen (siehe oben), denn die Soundausgabe wird auch nicht fkt, daja es funktionieren auch alle Programme, die keine copro Befehle nutzten. Und die Libraries findet Avr, denn unter Configuration Options/Libraries werden alle notwendigen Objekte wie libnibo2.a usw. angezeigt.Mit welcher Entwicklungsumgebung arbeitest Du? Zeig doch mal ein funktionierendes Programm./Nibo2.c:74: warning: implicit declaration of function 'sound_init'
Lesezeichen