Page 1 of 1

Astronomer app that include both 1066_1 and 1014_2 in same project

Posted: Mon Nov 18, 2019 7:56 am
by Marco
Good morning,
I am an amateur astronomer, living in Italy, using phidgets to automize my observatory. I bought a RC servo and a 0/0/4 interface and I am trying to develop an app in Visual Studio 2019 (Windows Form .net Framework) that should include both codes. So this is the situation:

- I have downloaded the codes of both devices (1066_1 and 1014_2)
- I started to merge the two codes in one code .
- I reached the level where I can see both devices attached and connected.
- I can activate the 0/0/4 interface.

Unfortunately I do not know how to engage the servo drive. In my code I want the servo drive to move to a fixed angle. The angle is written in a text file and the code should be readed from a text file. I am just asking the support of some kind person that could help me to write the code that permits to:

- read the servo angle from a text file
- engage the drive without click a button but as soon as the app start
- the drive should move to the defined angle
- at application exit: move the drive to angle 0 and disengage the servo drive.

Thank you so much for your suggestions and support.

Best Regards
Marco

Re: Astronomer app that include both 1066_1 and 1014_2 in same project

Posted: Mon Nov 18, 2019 2:22 pm
by mparadis
Hi Marco,

- There should be some tutorials online on how to read information from a text file in VB.NET. Just search for "VB.NET file io" and you'll find some helpful guides.

- Engaging the servo when the application starts is as simple as setting the Engaged property true in the attach handler for the servo channel instead of in the button click function.

- In order to be able to tell your servo motor what angle to move to, you'll also have to set a number of other properties in the attach handler for the servo channel: MinPulseWidth and MaxPulseWidth, which you can get from your servo's data sheet (or determine experimentally by going into the Phidget control panel and following this process), and MinPosition and MaxPosition, which will be the minimum and maximum position in degrees for your servo (usually 0 and 180). Once you've set these, you can set TargetPosition with the angle you read from the text file.

- To close cleanly at the end of your program, you can set TargetPosition to zero and set Engaged to false after the servo reaches its target (you can determine this by watching for a TargetPositionReached event or by polling IsMoving in a loop until it is false).

You can read more details about all of the properties (the words in bold) at our API page.