![]() |
Re: Rookie help
[edit] I confused the issue by mixing up the number of slow loops per second between the EDU (59) and the FRC (38) [/edit]
Well, we’re moving the servo a tiny bit (servo1++; equals approx. 60/255 degrees) each time counter adds up to: - 59 loops = 1 second (counter < 59) - 59/2 or ~30 loops = ½ second (counter < 30) - 59/19 or 1 loop = 17ms (counter < 2) We don’t have to move servo1 (+1) each time. A servo is made to jump immediately to an exact position. It just happened to be convenient for our example to move it slowly through it’s entire range of motion. You could have servo1 make bigger jumps like +5 or +10 if you like. You will have to become aware of what values the different variable types are made to hold. We declared servo1 to be an unsigned char. An unsigned char is only big enough to store the values 0 through 255. If you try to make it equal something outside this range, such as 300, you won’t get any error message, but you will get what seems to be a random number instead. |
Re: Rookie help
Ok, i understand the whole counter except how to calculate it
- 38/2 or 20 loops = ½ second (counter < 20) - 38/19 or 2 loops = .05 sec. (counter < 2) how do you know counter < 20 is equal to 38/2 and how do you know that is 1/2 a second [edit] and how/why is 1 second equal to 38 loops /************************************************** ***************************** * FUNCTION NAME: Process_Data_From_Master_uP * PURPOSE: Executes every 17ms when it gets new data from the master * microprocessor. [/edit] |
Re: Rookie help
The confusion is my fault. I'm mixing the numbers between the FRC and the EDU controller.
The EDU receives radio packets once every 17ms or approx 58.8 times per second. The FRC receives packets once every 26.2ms or approx 38 times per second. I'll go back and correct my examples above to reflect: ~59 = 1 second ~30 = 1/2 second ~15 = 1/4 second etc. |
Re: Rookie help
So how would i calculate whatever number i put in here
Code:
if (servo1 < 254)also here: Code:
if (counter < 2) // about half a second in the slow loop for one 60/255 degree turn (2 = 7 seconds, 20=2 minutes)[edit] also, where does my output go from Code:
printf("PWM OUT 7 = %d, PWM OUT 8 = %d\n",(int)pwm07,(int)pwm08); /* printf EXAMPLE */[/edit] |
Re: Rookie help
(counter < n) is the time between each distinct movement of the servo. Where n/59 = the time seconds. For example,
n= 59 is 1 second, n=118 is 2 seconds, n=30 = ½ second (servo1 += y) is how large a movement the servo will make each time (according to the above). For example, y=1 position and is the smallest movement the servo can make, y=5 moves 5 servo positions and because of this will appear to be 5 times as fast. You’ll have to change the limit check “if (servo1 < 254)” to match whatever number you use, to make sure servo1 will never end up greater than 255. For instance, if y=5 the check should become “if (servo1 < 250)” if y=10 the check should become “if (servo1 < 240)” The range of motion depends on the actual servo model you have. |
Re: Rookie help
Ok, for the servo +=5 is the little movements it makes before it resets?
If so i understand all that Code:
pwm03 = servo1;if so then 1 question not pertaining to the servos how does Code:
printf("PWM OUT 7 = %d, PWM OUT 8 = %d\n",(int)pwm07,(int)pwm08); /* printf EXAMPLE */ |
Re: Rookie help
Quote:
Quote:
In this case the statement probably shows up in the terminal window as: PWM OUT 7 = 127, PWM OUT 8 = 127 Do a search in Chiefdelpi for printf and you'll get a lot of information about it. You need to pick up a C programming book. printf is a standard C function. |
Re: Rookie help
So I can do pwm08 = servo1 and they will both moved if plugged in 3 and 8?
Also, I can just change the 7 and 8 to the 2 i am using and just load ifi loader to see whats happening? |
Re: Rookie help
Quote:
|
Re: Rookie help
Quote:
There are some PWM Ins along the top (the female connectors) for a hobby radio (similar to expensive RC cars or planes). Since I don't think you have one, don't worry about it. [edit]Sorry, that's a little old.[/edit] |
Re: Rookie help
I was messing with it last night and just got stuck on one thing
How would I make it go to the end, and then reset without stopping in the middle at times |
Re: Rookie help
Quote:
What you are seeing could be due to the servo not being given enough time to reach the requested position. The electronic controller operates much faster than the mechanical servo and could be sending position requests too quickly. |
Re: Rookie help
I wasn't seeing anything
I was just trying to make it go straight to the end and then reset and then loop |
Re: Rookie help
Quote:
What kind of delay do you have between changing positions (i.e., counter)? |
Re: Rookie help
Yeah like that, but i didnt put in a counter because I couldn't figure out how to time it
|
| All times are GMT -5. The time now is 02:29. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi