Archiv verlassen und diese Seite im Standarddesign anzeigen : [ERLEDIGT] Frage zu einem Programm zur base
Thorben W
13.07.2013, 16:36
Ich habe an meinem Rp6 2 Tastschalter angeschlossen und habe jetzt die Software angepasste nur ich bekomme immer die Warnmeldung:
25996 und das Programm funktioniert nicht.
Das Programm:
#include "RP6RobotBaseLib.h"
int main(void)
{
initRobotBase();
while(true)
{
task_hight_Bumpers();
if(getHIGHTBumperRight())
{
setLEDs(0b000110);
}
}
return 0;
}
Die Libs habe ich angehängt:25997 25998
Was muss ich machen? Was habe ich nicht beachtet?
Danke schonmal
Thorben
Naja,
der Kompiler kennt task_hight_Bumpers() und getHIGHTBumperRight() nicht.
Die sind auch nirgendwo definiert.
Thorben W
13.07.2013, 18:15
Doch.
RP6RobotBaseLib.c Zeile 247 - 335
/************************************************** ***************************/
// HIGHT_Bumpers:
/**
* Returns true if the the left Bumper is hit.
* This function turns off the LED connected to the port, reads the Bumper
* value and restores previous LED state afterwards!
*
* Example:
*
* if(getBumperLeft())
* // do something
*/
uint8_t getHIGHTBumperLeft(void)
{
PORTB &= ~SL5;
DDRB &= ~SL5;
nop();
uint8_t tmp = PINB & SL5;
if(statusLEDs.LED5) {
DDRB |= SL5;
PORTB |= SL5;
}
return tmp;
}
/**
* Returns true if the the right Bumper is hit.
* This function turns off the LED connected to the port, reads the Bumper
* value and restores previous LED state afterwards!
*
* Example:
*
* if(getBumperRight())
* // do something
*/
uint8_t getHIGHTBumperRight(void)
{
PORTC &= ~SL2;
DDRC &= ~SL2;
nop();
uint8_t tmp = PINC & SL2;
if(statusLEDs.LED2) {
DDRC |= SL2;
PORTC |= SL2;
}
return tmp;
}
// -------------------------------
// HIGHT Bumpers State changed handler:
void HIGHT_BUMPERS_stateChanged_DUMMY(void){}
static void (*HIGHT_BUMPERS_stateChangedHandler)(void) = HIGHT_BUMPERS_stateChanged_DUMMY;
/**
* Use this function to set the Bumpers state change handler.
*
*/
void HIGHT_BUMPERS_setStateChangedHandler(void (*hightbumperHandler)(void))
{
HIGHT_BUMPERS_stateChangedHandler = hightbumperHandler;
}
// -------------------------------
volatile uint8_t hight_bumper_timer;
uint8_t hight_bumper_left;
uint8_t hight_bumper_right;
/**
* If you call this frequently out of the mainloop (or use task_RP6System which
* calls this routine for you), the global bumper_left and bumper_right
* variables are updated automatically every 50ms and can be used everywhere
* in your program. It can also call an event handler routine, that you
* need to register with BUMPERS_setStateChangedHandler before.
*/
void task_hight_Bumpers(void)
{
if(hight_bumper_timer > 50) { // 50ms
uint8_t hleft = getHIGHTBumperLeft();
uint8_t hright = getHIGHTBumperRight();
if(hight_bumper_left != hleft || hight_bumper_right != hright) {
hight_bumper_left = hleft;
hight_bumper_right = hright;
HIGHT_BUMPERS_stateChangedHandler();
}
hight_bumper_timer = 0;
}
}
RP6RobotBaseLib.h
/ HightBumpers
uint8_t gethightBumperLeft(void);
uint8_t gethightBumperRight(void);
extern uint8_t hight_bumper_left;
extern uint8_t hight_bumper_right;
#define ishightBumperLeft() (hight_bumper_left)
#define ishightBumperRight() (hight_bumper_right)
void HIGHT_BUMPERS_setStateChangedHandler(void (*hightbumperHandler)(void));
void task_Hight_Bumpers(void);
Thorben
- - - Aktualisiert - - -
Danke Dirk waren Schreibfehler drin
@Thorben:
Danke Dirk waren Schreibfehler drin
Genau! Die Funktions- und Variablennamen müssen genau stimmen, auch Groß-/Kleinschreibung.
Thorben W
13.07.2013, 18:49
Kann man oft genug rüber gucken und sieht das nicht
Powered by vBulletin® Version 4.2.5 Copyright ©2024 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.