Phidgets Control Panel Works Code Samples Dont

I got my Phidgets Control Board and servos yesterday and I immediately started messing around with them. It was easy to hook up and install all the stuff you need to program against them. Very… plug-and-play-ish. So I did what the quick start said and I fired up their Control Panel and tested out the servos I had hooked up just to test make sure all was ok. Everything went fine there, so onto my next adventure, their code samples. I opened up just the simple servo example to test that out. That’s when I ran into my little problem. The code stopped at the waitForAttachment() call:


//Get the program to wait for a Servo to be attached
Console.WriteLine("Waiting for Servo to be attached...");
servo.waitForAttachment();

So after being late for the other things I had going on last night, I still did not know what to do. I poked around, my friend Ryan suggested I try a different version of the .NET framework, I hooked up different servos, the list goes on…

I finally stumbled upon a forum post which doesn’t really relate to what I was experiencing. However … In the reply that was posted I noticed that the Servo was declared as AdvancedServo not Servo like in the example that is provided in the download. Here’s what I mean:

The sample code looks like this:


//Declare a Servo object
Servo servo = new Servo();

The post has the declaration looking something like this:


//Declare a Servo object
AdvancedServo servo = new AdvancedServo();

So I changed the declaration in the code sample to be AdvancedServo and everything worked fine. The code got past the call to waitForAttachment() and the servo started moving. Yay! I’m still reading up on the programming concepts/etc. with Phidgets but I would assume that the difference is that AdvancedServo services either a new model or… Advanced one and Servo was the first revision. So if I had a plain Jane Servo and not an Advanced one ( didn’t know I was that special ) the code would have probably worked.

Strange behavior though, the Phidgets Control Panel was able to move the servo but the demo-apps and Code Samples were not able to due to this little snafu. The control panel probably detects the type and then goes on…

Anyway, that’s all.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>