hm.., danke dirkaber muss ich denn noch den elko mit einbauen, so wie du es mir gesagt hast? oder geht es auch ohne?
und wenn ja, einfach gnd mit +ub mit dem elko verbinden, ja?
... klingt doch gut ...
Gruß Dirk
hm.., danke dirkaber muss ich denn noch den elko mit einbauen, so wie du es mir gesagt hast? oder geht es auch ohne?
und wenn ja, einfach gnd mit +ub mit dem elko verbinden, ja?
Ja, also Elko+ an +UB und Elko- (Markierung) an GND. Den Elko direkt in die Nähe der deiner Schaltung.... einfach gnd mit +ub mit dem elko verbinden, ja?
Zum Ausprobieren verbindest du am besten nur +UB und GND mit deiner Schaltung, aber noch nicht den 270 Ohm Widerstand mit dem ADC0 Pin.
Wenn du dann das offene Ende des 270 Ohm Widerstands kurz an +5V (VCC) hälst, müßte der Pfeil losfliegen.
Wenn das so klappt, müßte es auch mit einem Programm klappen, in dem man ADC0 z.B. für 300ms auf high setzt und dann wieder auf low.
Gruß Dirk
cool vielen dank!! ich probier es aus!!
so ich war heute 2stunden beim roboter und nun tuts... naja zumindest vom mechanischem her. ich stelle euch mein programm mit rein, falls es euch interessiert. das funktioniert nämlich so: ich habe als grundlage ersteinmal das beispielprogramm 'acs' genommen und immer wenn der linke bumper gedrückt wird, werden die pfeile geschoßen :
problem dabei ist immoment nur, dass wenn ich einmal den linken bumper drücke, dann schießt die kanone so lange, bis ich nochmal auf den linken bumper drücke. doch eigentlich soll es ja so sein, dass wenn man den bumper einmal berührt, dass er dann einen pfeil schießt. und wenn man ihn dann noch mal berührt, soll noch ein pfeil rausgeschoßen werden... wo liegt der fehler?Code:// Includes: #include "RP6RobotBaseLib.h" // Always needs to be included! /*****************************************************************************/ /** * This function works similar to the ACS function and gets called everytime the * Bumpers are hit (the Bumpers need to be pressed down for at least 100ms to make * sure that it is registered by the program!) */ void bumpersStateChanged(void) { writeString_P("Bumpers state changed! BPL: "); if(bumper_left) // Left Bumper { writeChar('o'); schuss(); } else writeChar(' '); writeString_P(" | BPR: "); if(bumper_right) // Right Bumper writeChar('o'); else writeChar(' '); writeChar('\n'); } void schuss(void){ writeChar('s'); if(PORTA == 0) PORTA = 1; else PORTA = 0; } /*****************************************************************************/ // Main - The program starts here: int main(void) { initRobotBase(); // Always call this first! The Processor will not work // correctly otherwise. // Write Message to UART: writeString_P("\nRP6 ACS - Testprogram\n"); writeString_P("_____________________\n\n"); setLEDs(0b111111); mSleep(1000); setLEDs(0b001001); // --------------------------- // Register Event Handlers: // Set Bumpers state changed event handler: BUMPERS_setStateChangedHandler(bumpersStateChanged); // --------------------------- powerON(); // Activate all important Systems and turn power LED on. // You always need to perform this command before you can // use the ACS! // Usually some of the RP6 Systems like the encoders, the ACS // (and thus also IRCOMM reception), // the current sensors and the power on LED are turned off to // save Battery power (saves about 10mA). // You can use powerOFF() to disable all those systems. // --------------------------- setACSPwrMed(); // Set ACS to medium power/range // These are the __alternative__ settings: // setACSPwrLow(); // Low power // setACSPwrHigh(); // High Power // and of course you can use: // setACSPwrOff(); to turn it off completely! // You can uncomment (= remove the "//" in front of a line) ONE of these // lines and test how it affects the maximum range of the ACS and which // Obstacles it can detect. // --------------------------- // selbst geschriebener Abschuss DDRA = 1; // ADC0 auf Ausgang // Main loop while(true) { // This very very important function: task_RP6System(); // handles a lot of things for you. For this example, it controls the // ACS and sets the obstacle_right and obstacle_left values if it detects // an obstacle. If you registered an event handler (s. above), it calls this // event handler automatically as soon as one of these two values changes. // Nearly the same applies for the bumpers - you can check the state // of each bumper with bumper_left and bumper_right and everytime the // state changes the event handler is called automatically. // In some of the next examples you will see that this function also // controls the motors and some motion functionality. // But be careful with delay functions or other things that take a long // time (gets problematic if there are delays greater than 50ms) if you // use this! The delays may disturb the automatic control of all those // systems mentioned above. // Why do we need such a function? // Well, several things that the MEGA32 needs to take care about are not // that easy to understand (look at the task_ACS function // and some of the other functions in the RP6RobotBaseLib.c!) // and this makes it a lot easier for you! // The only thing you really need to take care about is to call // task_RP6System frequently! Then you will not have big problems usually. } return 0; }
Hallo
Prima. Allerdings sind deine Portmanipulationen nicht ganz korrekt:
DDRA |= 1; // ADC0 auf Ausgang, alle anderen Pins bleiben unbeeinflußt
Die Funktion schuss() würde ich rausschmeissen:
Das schiesst solange du drückst.Code:if(bumper_left) // Left Bumper { writeChar('o'); PORTA |= 1; //ADC0 high = Schuss } else { writeChar(' '); PORTA &= ~1; // ADC0 low = Ende Schuss }
Gibts schon ein Video?
Gruß
mic
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
hallo, radbruch,
wenn du willst, kann ich morgen gerne ein video machen,
doch zu dem programm nochmal,
könntest du das vielleicht mal versuchen in mein programm einzubinden?
bei mir kam da beim kompilieren ne fehlermeldung![]()
Mit den oben beschriebenen Änderungen kann ich dein Progamm so übersetzen:
Videos sind immer klasse :)Code:// Includes: #include "RP6RobotBaseLib.h" // Always needs to be included! /*****************************************************************************/ /** * This function works similar to the ACS function and gets called everytime the * Bumpers are hit (the Bumpers need to be pressed down for at least 100ms to make * sure that it is registered by the program!) */ void bumpersStateChanged(void) { writeString_P("Bumpers state changed! BPL: "); if(bumper_left) // Left Bumper { writeChar('o'); PORTA |= 1; //ADC0 high = Schuss } else { writeChar(' '); PORTA &= ~1; // ADC0 low = Ende Schuss } writeString_P(" | BPR: "); if(bumper_right) // Right Bumper writeChar('o'); else writeChar(' '); writeChar('\n'); } /*****************************************************************************/ // Main - The program starts here: int main(void) { initRobotBase(); // Always call this first! The Processor will not work // correctly otherwise. // Write Message to UART: writeString_P("\nRP6 ACS - Testprogram\n"); writeString_P("_____________________\n\n"); setLEDs(0b111111); mSleep(1000); setLEDs(0b001001); // --------------------------- // Register Event Handlers: // Set Bumpers state changed event handler: BUMPERS_setStateChangedHandler(bumpersStateChanged); // --------------------------- powerON(); // Activate all important Systems and turn power LED on. // You always need to perform this command before you can // use the ACS! // Usually some of the RP6 Systems like the encoders, the ACS // (and thus also IRCOMM reception), // the current sensors and the power on LED are turned off to // save Battery power (saves about 10mA). // You can use powerOFF() to disable all those systems. // --------------------------- setACSPwrMed(); // Set ACS to medium power/range // These are the __alternative__ settings: // setACSPwrLow(); // Low power // setACSPwrHigh(); // High Power // and of course you can use: // setACSPwrOff(); to turn it off completely! // You can uncomment (= remove the "//" in front of a line) ONE of these // lines and test how it affects the maximum range of the ACS and which // Obstacles it can detect. // --------------------------- // selbst geschriebener Abschuss DDRA |= 1; // ADC0 auf Ausgang // Main loop while(true) { // This very very important function: task_RP6System(); // handles a lot of things for you. For this example, it controls the // ACS and sets the obstacle_right and obstacle_left values if it detects // an obstacle. If you registered an event handler (s. above), it calls this // event handler automatically as soon as one of these two values changes. // Nearly the same applies for the bumpers - you can check the state // of each bumper with bumper_left and bumper_right and everytime the // state changes the event handler is called automatically. // In some of the next examples you will see that this function also // controls the motors and some motion functionality. // But be careful with delay functions or other things that take a long // time (gets problematic if there are delays greater than 50ms) if you // use this! The delays may disturb the automatic control of all those // systems mentioned above. // Why do we need such a function? // Well, several things that the MEGA32 needs to take care about are not // that easy to understand (look at the task_ACS function // and some of the other functions in the RP6RobotBaseLib.c!) // and this makes it a lot easier for you! // The only thing you really need to take care about is to call // task_RP6System frequently! Then you will not have big problems usually. } return 0; }
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
bei mir kommt da dann beim kompilieren
> "make.exe" all
-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
make.exe: *** No rule to make target `RP6Base_ACS.elf', needed by `elf'. Stop.
> Process Exit Code: 2
> Time Taken: 00:00
hat dazu niemand eine lösung??
Lesezeichen