Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
Hmmmm but on gcc for microcontrollers it sets unsigned int to 256, where its 8 bit, or 2^8.
(not 4294967295 Grin)
Sorry for being 'pedantic', I was just poking fun Tongue
microseconds=microseconds/16;
well the delay_us function is calculated by whats in global.h right?so whats your F_CPU?
SERVO CENTER CODE People ask all the time for the code used to center the servo. Well, here you go! while(1) { if(button_pressed()) { wheel_left(700); delay_ms(20); } }
Use this:234/1.003*(time in milliseconds) = number of cycles
Let’s compute how many cycles the 1.5 ms correspond. For this case, the number of cycles would be…23/.992*(1.5) = 34.8 (let’s make an integer of 35).
Also, centering can be different if you modded the servo differently. You might find it centering between 500-700.