go away spammer

Author Topic: servo centering code errors  (Read 4957 times)

0 Members and 1 Guest are viewing this topic.

Offline Carter05Topic starter

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
servo centering code errors
« on: September 02, 2008, 05:38:32 PM »
I'm trying to build the servo centering code from the Axon source files and it's giving me all sorts of errors. I guess it's fair to say I've never downloaded anything to a micro controller before so it could be just me! I have attached a screenshot in the hopes someone can point me in the right direction.

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,431
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
    • Nerdcore - Programming, Electronics, Mechanics
Re: servo centering code errors
« Reply #1 on: September 02, 2008, 05:56:44 PM »
i can't really see all your code in that screen shot.

I think those PORT declarations are predefined macros somewhere in io.h or something like that.

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: servo centering code errors
« Reply #2 on: September 02, 2008, 05:58:24 PM »
you are missing all those header files that you need to put in

You are using an Axon?
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Carter05Topic starter

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
Re: servo centering code errors
« Reply #3 on: September 02, 2008, 06:56:56 PM »
Ya I'm using an Axon. I finally got the batteries and such today so I figured I'd play around with it. I'm using the servo centering code strait from the axon source file download. As I said, I've never done this sort of stuff before. Also just click the picture and it will enlarge to full size.
« Last Edit: September 02, 2008, 06:58:21 PM by Carter05 »

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: servo centering code errors
« Reply #4 on: September 02, 2008, 07:18:29 PM »
Follow the getting started tutorial all the way through . At the end of the tutorial you should have a source file called "control.c". Open that up and delete everything in that file. Now paste the code below.

Code: [Select]
void control(void) {
while(1)     // begin infinite loop
{
servo(PORTE,2,700)    // Call the macro to control the servo , where 700 is the amount of cycles
       // where PORTE is the port and 2 is the pin on the port. The servo is connected to PORTE.2 according to this example

delay_ms(20);   // delay 20 milliseconds so we don't confuse the servo
        }    // end while

} // end subroutine

To better understand the relationship between cycles and time and angle check out this program I made .( windows)
http://erobots.blogspot.com/2008/08/update-for-servo-position-calculator.html
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Carter05Topic starter

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
Re: servo centering code errors
« Reply #5 on: September 02, 2008, 08:18:31 PM »
I guess I'm more confused on the elementary thing of which things I need to include to get any code to run right.

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: servo centering code errors
« Reply #6 on: September 02, 2008, 08:27:18 PM »
I guess I'm more confused on the elementary thing of which things I need to include to get any code to run right.

follow the Getting Started tutorial on the Axon page
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Carter05Topic starter

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
Re: servo centering code errors
« Reply #7 on: September 02, 2008, 09:19:37 PM »
I figured it out! Thanks man. Another question, how come I don't need to add all of the #include files that are listed? Such as the servo_controller.c?

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: servo centering code errors
« Reply #8 on: September 02, 2008, 09:20:27 PM »
I figured it out! Thanks man. Another question, how come I don't need to add all of the #include files that are listed? Such as the servo_controller.c?
because you aren't using teh stuff in servo_Controller.c  you only include the stuff you use in your code.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Carter05Topic starter

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
Re: servo centering code errors
« Reply #9 on: September 02, 2008, 09:25:36 PM »
Ah I see, I understand it all now! Thanks for your help. I'll have many more questions as I go I'm sure.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: servo centering code errors
« Reply #10 on: September 02, 2008, 10:00:50 PM »
servo_controller.c isn't actually a working program yet. It was something I am working on, and just left in the zip file of other source files. Just ignore it for now and don't run it.

 


Get Your Ad Here