Servo Code!

Show off your projects to others!
KM6VV
Posts: 121
Joined: Fri Jun 03, 2011 7:45 pm
Location: Central Coast, CA

Re: Servo Code!

Post by KM6VV » Wed Jun 29, 2011 12:30 am

Thanks! I will!

Alan KM6VV

red24dog
Posts: 6
Joined: Sat Jun 18, 2011 5:14 pm

Re: Servo Code!

Post by red24dog » Sat Jul 09, 2011 3:36 am

I note there is no "keywords.txt" file in your MakeshiftServo.zip package (along with the MakeshiftServo.cpp and MakeShiftservo.h files). To make a complete library folder, should I simply copy the keywords.txt from the existing "Servo" folder into the new "MakeshiftServo" folder?

davec
Posts: 30
Joined: Tue Jun 28, 2011 1:04 pm

Re: Servo Code!

Post by davec » Sat Jul 09, 2011 7:36 am

red24dog wrote:To make a complete library folder, should I simply copy the keywords.txt from the existing "Servo" folder into the new "MakeshiftServo" folder?
Yes, if you like. It is only for syntax highlighting in the IDE.

sierrasmith71
Posts: 34
Joined: Mon May 23, 2011 7:22 pm

Re: Servo Code!

Post by sierrasmith71 » Fri Aug 05, 2011 10:24 pm

davec wrote:OK, try this. I've named it "MakeshiftServo" so it won't be mistaken for an "official" version.

This works for very well me... I need only 8 servos. Any chance of adding a timer driven speed variable?

I can use a for loop with delays to do this, but it is too much overhead, I (the UNO32) need to do other things while the commanded servo is moving..1-3 seconds is what I am looking for. I used a library named varSpeedServo with the UNO that worked great.


David Garrison :D

davec
Posts: 30
Joined: Tue Jun 28, 2011 1:04 pm

Re: Servo Code!

Post by davec » Sat Aug 06, 2011 1:33 am

sierrasmith71 wrote:I used a library named varSpeedServo with the UNO that worked great.
David Garrison :D
Thanks, that's a really useful library so I've added timed move code from it to MakeshiftServo (attached), with a new sample program that demonstrates it.
Attachments
MakeshiftServo2.zip
(9.47 KiB) Downloaded 204 times

sierrasmith71
Posts: 34
Joined: Mon May 23, 2011 7:22 pm

Re: Servo Code!

Post by sierrasmith71 » Sun Aug 07, 2011 3:53 pm

davec wrote:
sierrasmith71 wrote:I used a library named varSpeedServo with the UNO that worked great.
David Garrison :D
Thanks, that's a really useful library so I've added timed move code from it to MakeshiftServo (attached), with a new sample program that demonstrates it.

I downloaded your code and tried it out ; it works very well indeed.

My problem is with the MakeshiftServo library restriction on pin 3 use, as a connection of the color LCD, I am using, is wired to pin 3. There is no way to change this as the graphics library uses RD0-7 directly..pin 3 is either OC1 or RD0....bummer.

Do you think that this pin 3 restriction will also apply to the ChipKit porting of the Arduino servo Library?????

Thanks for work!

Best Regards

David Garrison :(

davec
Posts: 30
Joined: Tue Jun 28, 2011 1:04 pm

Re: Servo Code!

Post by davec » Tue Aug 09, 2011 4:05 am

sierrasmith71 wrote: Do you think that this pin 3 restriction will also apply to the ChipKit porting of the Arduino servo Library?????
No, the new servo code is in git now (Servo.cpp) and it only uses timers so no need for the OC pin. Haven't tried it yet but it looks good.

I was a bit surprised to see:

Code: Select all

#define usToTicks(_us)    (1.25* _us) 
#define ticksToUs(_ticks) ( (unsigned)_ticks/1.25) 
Won't this do a float calculation?

sierrasmith71
Posts: 34
Joined: Mon May 23, 2011 7:22 pm

Re: Servo Code!

Post by sierrasmith71 » Tue Aug 09, 2011 2:52 pm

davec wrote:No, the new servo code is in git now (Servo.cpp) and it only uses timers so no need for the OC pin. Haven't tried it yet but it looks good.
Good news indeed!

Do you plan to work your magic again and produce a VarSpeedServo version of this library ? I surely hope so, as I need it for my application..

David Garrison :D

KM6VV
Posts: 121
Joined: Fri Jun 03, 2011 7:45 pm
Location: Central Coast, CA

Re: Servo Code!

Post by KM6VV » Tue Aug 09, 2011 7:54 pm

is the new servo.cpp only for the MAX?

Alan KM6VV

davec
Posts: 30
Joined: Tue Jun 28, 2011 1:04 pm

Re: Servo Code!

Post by davec » Tue Aug 09, 2011 11:45 pm

KM6VV wrote:is the new servo.cpp only for the MAX?
No, it works on the UNO32 as well.

Post Reply