Society of Robots - Robot Forum
Software => Software => Topic started by: rox2007 on January 14, 2008, 02:08:21 PM
-
Ok i followed the instructions in the modifying servos tutorial but i cant get the part where you stop the gears by moving the pothead.
I keep turning it left and right but it doesnt work.
Please help
-
move it slowly and make sure you are giving it the right pulse at the corerct oscillator setting
-
what exactly is the right pulse and oscillator setting for an atmega 168. i am passing 1.5ms on the internal 8Mhz clock
-
i turn and turn and turn. The speed just get's slower or faster. it goes from one extreme to another. fast to slow...slow to fast....theres no midpoint where it just stops
-
turn it very slowly and carefully
also try to give it 1.5ms @ 4mhz
what is your code ?
-
#include <avr/io.h>
//Define functions
//======================
void ioinit(void); //Initializes IO
void delay_ms(uint16_t x); //General purpose delay
void delay_cycles(unsigned long int cycles);
//======================
int main (void)
{
ioinit(); //Setup IO pins and defaults
while(1)
{
PORTC = 0xFF;
PORTB = 0xFF;
PORTD = 0xFF;
delay_cycles(35);
PORTC = 0x00;
PORTB = 0x00;
PORTD = 0x00;
delay_cycles(35);
//delay_cycles(500);
}
return(0);
}
void ioinit (void)
{
//1 = output, 0 = input
DDRB = 0b11111111; //All outputs
DDRC = 0b11111111; //All outputs
DDRD = 0b11111110; //PORTD (RX on PD0)
}
//************DELAY FUNCTIONS************
//wait for X amount of cycles (23 cycles is about .992 milliseconds)
//to calculate: 23/.992*(time in milliseconds) = number of cycles
void delay_cycles(unsigned long int cycles)
{
while(cycles > 0)
cycles--;
}
//***************************************
-
that's my code. i was running at 8mhz and sending 1.5ms
-
which servo are you using?
-
HS-311, the ones recommended by the tutorial
-
I finally got it to work...Thanx alot
-
just as i was about to post this
http://www.instructables.com/id/modify-the-hitec-hs-325-servo-for-continuous-rotat/
-
Help people with the same problem, tell us what was the problem and how you fixed it.
-
well, i sent a 1.5ms pulse and ran my atmega168 at 4 mhz...and i rotated the pot until the gears stopped
-
at what mhz?
-
Since nothing else seems to be working, I used the OP's code but can't see where to change the frequency. I'm using AVR Studio.
-
at what mhz?
well, i sent a 1.5ms pulse and ran my atmega168 at 4 mhz...and i rotated the pot until the gears stopped
;D
-
at what mhz?
well, i sent a 1.5ms pulse and ran my atmega168 at 4 mhz...and i rotated the pot until the gears stopped
;D
to garriwilson
the 4mhz was edited in his post AFTER I replied ;)
-
i did, sorry about that
-
Oh my bad ;)