hm.... der Compiler mekert das viele Variablen undeclared sind. Geht es auch so: moveAtSpeed3(speed_links, speed_rechts, dir_links, dir_rechts); ???
hm.... der Compiler mekert das viele Variablen undeclared sind. Geht es auch so: moveAtSpeed3(speed_links, speed_rechts, dir_links, dir_rechts); ???
Hallo
uint16_t distance, distance_left, distanceright;
Hier fehlt der Unterstrich in distanceright.
Bringt moveAtSpeed3() einen Vorteil? Es gibt doch nur vier Kombinationen.
GrußCode:// Richtung: 0 = Vorwärts, 1 = Rückwärts moveAtSpeed3(uint8_t desired_speed_left, uint8_t desired_speed_right, uint8_t dir_left, uint8_t dir_right) { moveAtSpeed(desired_speed_left, desired_speed_right); setMotorDir(uint8_t dir_left, uint8_t dir_right); // Kommentar in der Lib beachten! }
mic
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
das mit setMotorDir ist genau das was ich gesucht hab, aber:
undefined reference to `setMotorDir'
Möglicherweise wurde die Funktion rausgeschmissen:
Code:/** * Sets the rotation direction of both motors. * * DO NOT CHANGE THE DIRECTION OF THE MOTORS WHILE THEY * ARE RUNNING AT HIGH SPEEDS!!! * It will not instantly damage the motors/gears, but they will * wear out much faster if you do it at high speeds - better wait * until speed has slowed down - and change direction AFTER this. * * ------------------------------------------------------------- * IT IS A BETTER IDEA NOT TO USE THIS FUNCTION AT ALL! * Use moveAtSpeed together with task_motionControl instead. * YOU CAN NOT USE setMotorPower AND setMotorDir WHEN YOU USE * task_motionControl! This will not work! * ------------------------------------------------------------- * * task_motionControl also ensures that the direction is changed * slowly and only after the motors have stopped! * * Example: * // DO NOT perform these commands directly after each * // other in your programs - this is just a LIST of possible * // combinations: * setMotorDir(FWD,FWD); // Move forwards * setMotorDir(BWD,FWD); // Rotate right * setMotorDir(FWD,BWD); // Rotate left * setMotorDir(BWD,BWD); // Move backwards * */ void setMotorDir(uint8_t left_dir, uint8_t right_dir) { mleft_dir = left_dir; mright_dir = right_dir; mleft_des_dir = left_dir; mright_des_dir = right_dir; if(left_dir) PORTC |= DIR_L; else PORTC &= ~DIR_L; if(right_dir) PORTC |= DIR_R; else PORTC &= ~DIR_R; }
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Der Compiler meckert:
PC.c:24: error: 'DIR_R' undeclared (first use in this function)
PC.c:20: error: 'DIR_L' undeclared (first use in this function)
PC.c:18: error: 'mright_des_dir' undeclared (first use in this function)
PC.c:17: error: 'mleft_des_dir' undeclared (first use in this function)
PC.c:16: error: 'mright_dir' undeclared (first use in this function)
PC.c:15: error: 'mleft_dir' undeclared (first use in this function)
ich benutze die M32.
Geändert von AsuroPhilip (16.10.2011 um 10:55 Uhr)
Irgendwie klemmt's heute extrem. Bindest du die Library ein?
#include "RP6RobotBaseLib.h"
In task_motionControl() wird bei Stillstand die Richtung ausgewählt:
Code:if(!TCCR1A) // Is the PWM module turned off? { // Yes, change direction and restore old speed: setMotorDir(mleft_des_dir,mright_des_dir); mleft_des_speed = mleft_des_speed_tmp; mright_des_speed = mright_des_speed_tmp; left_i = 0; right_i = 0; }
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
"ich benutze die M32." Aua
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Lesezeichen