Learning Spin: Objects

screen_0.png

In this tutorial, I'll show you how to drive multiple servos at once with the Propeller. Along the way, I'll also introduce you to using objects.  My other tutorials (including my written objects guide) are here.

https://vimeo.com/16068259

I also use Servo32v7 from

I also use Servo32v7 from the OBEX to control TOBI’s HB-25’s and the servos. It is such a cool object!

Why is this?

Why do your tutorials keep coming out 1 day after I figure someting out?!

https://www.robotshop.com/letsmakerobots/node/23204

I have good timing

Good video.  There are a bunch of H-Bridge motor driver objects - I don’t think all of them ramp. 

One thing for all beginners to remember - a new object does not always equal a new cog.  The servo object is a good example - it will use one cog to drive the servos, but it can also use 2 cogs if you want to enable ramping.  Other objects, however, may not use a new cog (like reading a ping sensor), their methods run within the calling cog.  You could make them run in a new cog by using the cognew command, though.

Ya that is what I do for TOBI

I have one method in my top object that is launched into its own Cog. It just loops over and over again. It reads variables from the first Cog to find out what PING)))'s to read and what servo position to send to my sensor array and then it launches the PING.Spin object to read each PING))) into a set of distance variables. The distance variables that it writes to are used by the main Cog in an object avoidance Method.

Objects that don’t do what you want.

This is becoming a theme --These moments of clarity where I realize something that seems so obvious in hindsight. Modify the object! I have no idea why I didn’t think to do this or that I couldn’t do it but I have now and it is great. Yeah, I simply added to the PWM object some extra methods that allow me to go straight to a speed without ramping. I was also able to take the ping object, strip it down and modify it to work with a LV-EZ1 sonar sensor. Problem solved. --and a lot of problems in the future solved.