-
hi,
es gibt noch viele, viele dinge beim asuro wo ich sehe, dass sie funktionieren aber noch nicht weiss warum. Habe jetzt z.b. folgenden code
Code:
#include "asuro.h"
#include "ultrasonic.h"
int main(void)
{
int abstand;
Init();
abstand = Chirp();
while(1)
{
abstand = Chirp();
StatusLED(GREEN);
if (abstand < 10)
{
StatusLED(RED);
BackLED(ON,ON);
EncoderInit();
GoTurn(0, -90, 150);
}
else
{
StatusLED(GREEN);
BackLED(OFF,OFF);
MotorDir(FWD, FWD);
MotorSpeed(170, 150);
}
}
return 0;
}
ausprobiert, der asuro fährt (einigermassen) geradeaus und biegt 10cm vor einem hindernis nach links ab. probiere es mal...
hoffe es hilft...
-
Danke für den Code, habs getestet - gleiches Problem, Asuro dreht jetzt auch einem Rad rückwärts. Ich werde mir nochmal die US-Platine genau ansehen, möglicherweise habe ich beim zusammenbauen eine Fehler gemacht.
Gruß
Pinsel
-
Hat irgend jemand von euch die US-Platine aus dem eBay (hinten steht "c by M. Klein drauf)?
Ich sollte wissen, wo genau welcher Widerstand hinkommt.
-
ist im endeffekt doch nur ein teilesatz oder? ohne ebay nummer können wir das nicht wissen.
aber der schaltplan ist im ersten buch.
-
OK dalmator,
ich habe mir nochmals den Schaltplan genau angesehen, Fehler gefunden und behoben. Es waren 2 Widerstände vertauscht. Jetzt funktionierts, wenn ich diesen Code verwende:
Code:
#include "asuro.h"
#include "ultrasonic.h"
#define MAXDIFF 100
int main(void)
{
int abstand, abstand_alt, diff, zaehler=0;
Init();
abstand = Chirp();
while(TRUE)
{
abstand_alt = abstand;
abstand = Chirp();
++zaehler;
diff = abstand - abstand_alt;
if( (abstand>15) && (abs(diff)<MAXDIFF) )
{
StatusLED(GREEN);
MotorDir(FWD, FWD);
MotorSpeed(150, 150);
}
else if( (abstand>10) && (abstand<=15) && (abs(diff)<MAXDIFF) )
{
StatusLED(GREEN);
MotorDir(FWD, FWD);
MotorSpeed(100, 150);
Msleep(30);
}
else
{
StatusLED(RED);
MotorDir(RWD, RWD);
MotorSpeed(150, 100);
Msleep(100);
}
if (zaehler > 400)
{
StatusLED(RED);
BackLED(ON,ON);
MotorDir(RWD, RWD);
MotorSpeed(200, 250);
Msleep(10);
BackLED(OFF,OFF);
}
if (zaehler > 405)
{
StatusLED(RED);
BackLED(ON,ON);
MotorDir(RWD, RWD);
MotorSpeed(250, 200);
Msleep(10);
BackLED(OFF,OFF);
if(zaehler > 410)
zaehler = 0;
}
}
return 0;
}
Damit kriegt allerdings mein Asuro mit der Zeit einen Linksdrall. Ich werde noch dran feilen, möglicherweise hast du mir noch einen Ratschlag...
Die eBay - Nummer vom US-Bausatz ist übrigens 330198321285, wenn's jemanden interessiert.
Gruß
Pinsel
-
den linksdrall würde ich mir mit der ungleichheit der motoren erklären. wenn du den ultraschallbeusatz nich verwendest sondern der asuro nur mit 150,150 vorwährts fahren lässt, fährt er ja auch nicht geradeaus.