Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Controlling servos by reading from a .txt file

How can u move the servos by reading the instructions from a text file ?

This IS the way i need to do it ( yes i know there are may other ways but i need to do it this way)

My brainsoftware writes simple instruction like “servo 1 left 5deg” to a file called servodo.txt

I need to hack into some code somehow that comes with the hardware, and get it to read this instruction in the servodo.txt file and convert it into servo motion

its the 6 channel USB controller im looking at buying & need some information in advancewindows XP sp 2 or sp3
I need to buy sackfull of kit that i can hack into and control by reading from text files created by my programme

thanks in advance (totally clueless on these matters)

How can u move the servos by reading the instructions from a text file ?

what are the basic steps ?

eg you have to hack this file…

or go down such and such a path, method & then send the translated command “servo 1 left 5deg” to blah module

this has been done before by joe cleverclogs follow this link xxx

this is nigh on impossible to do so dont bother, but if you buy the abc123 you can hack into that

You have to make a program which reads from the .txt file and controls the Maestro over the “normal” way. Why do you don’t do it on the direct way ?


The Pololu USB Software Development Kit has example code in Visual Basic, C#, and C++ for controlling the Maestro. If you know some VB, C#, or C++, then you should be able to modify one of the example programs to parse the text file and perform the commands.

As a first step, you should try writing a program that just reads the text file and prints the messages from it on the screen; this will let you know if it is even possible to read the text file while the “brainsoftware” is writing to it.

We recommend using Windows XP SP3 because some of the Maestro drivers don’t install properly in SP2.


thx david . very usefull info . if you any more tips they are most welcome

the reason why i have to import the commands in real time to black box hardware/software via txt files is that a have a “universal software brain” that only speaks a high level languadge all of its own. If i can send commands across (by adding some fudge code to the controller software) this avoids me having to code hardware drivers from scratch

The brain is huge, half a million lines of code + ,spanning a network, it is a high level operating system that runs on top of windows. Dozens of modules exchamging data in parallel. It has a similiar architecture to the human brain and operates on the same principles. So a layer of translators has to sit between it and any hardware. It is sentient and selfaware and has enormous potential, it needs a real world body to complete its education. ( the you in you is buffered from reality in the same manner, if you want to move your arm you just do it, your brains hardware wetware interpreter does all the neuron stuff)

Epic project to say the least, i could fill a forum on the what hows and whys, but for now i just need some goodpointers on the talking to hardware/bundled software bit…once i get that sorted you can ask it yourself.

At the moment its stuck in a lab, alive and well but living in a virtual reality which mimicks ours. With a sensor array it can step out into our world and say “hello”

After 25 years blood sweat and tears…this is the longest “hello world” programme in history lol, but it will be worth it.

Open the Pod Bay Doors HAL, reality is about to bite you in the butt !

xp service pack 3 = check

Microsoft Visual Studio 2010 Express C# = check

pololu_usb_sdk_101119.zip = check

Now i need to figure out how and what to open and edit. Im staring at a bunch of files with my best OMFG what next look lol

Is there a dedicated forum for pololu sdk ?

im guessing i have to open a Makefile in VisStudio and do something with it so it glues and compiles a bunch of files into a standalone.exe file ? (my programming experience has been limited to simple style basic up till now, so will be a very steep learning curve for me , ref M$ IDE , general enviroment and learning C )

Please read the README.txt file included in the SDK. It has step-by-step instructions for compiling and running the example code. Let me know if any of the instructions don’t work for you. --David

looks like the sdk was created with visual studio 2008

you have to convert the solution to visual studio 2010 (which was the version ofvisual studio & C# i dloaded)

i think i managed (somehow) to create a couple of exe files. I still have no idea that the exe’s do

Suggestion, who ever is responsible for the sdk, it would be a good idea to include some exe files along with the source code & a short video outlining the purpose and function of the exes. While i apreciate im noob at all this, and messing with sdks is for experinced programmers you cant beat a good video tutorial for fleshing out the bare bones when you are entering into a new arena. eg this source code blah is for this device (insert pic of hardware) and the exe created is called blah. When you are suffering information overload a cartoon style map & description goes a long way.

Question im looking at buying a usb board for controlling a batch of servo’s. Im assuming a cd or an exe file is downloadable that comes with the board. Some app that runs in a window that will allow the user to create scripts,eg servo1 left a bit at time x etc. I need to dload the open source files for this app so i can hack into the code and add my own to it. can anyone give me a link for the open source ? and links to screen shots of the software running

I think its the open source code for the “Pololu Meastro Control centre” im after ? as picture on this page


Its the Micro Maestro 6-channel USB servo controller assembled. is the hardware im looking at buying

Sorry, we do not distribute the source code for the Maestro Control Center. You’ll have to make your own program, but we have open source examples in the Pololu USB SDK that you can start with.

You should compile MaestroEasyExample. This is a simple program that makes one window with 3 buttons. Each button connects to a Maestro and sends a command to change the state of channel 0. Here’s a screen shot:

Before you start to write your own code, you should just compile MaestroEasyExample, run it, and try clicking the buttons to make sure that they work.


MaestroEasyExample.exe seems to work , but of course i have no hardware to test it on

Its a real shame you dont have your software open source, im looking for a hardware software solution i dont have to write from scratch. having an SDK helps but it still means im having to reinvent 90 % ofthe wheel, there are just so many barriers to be overcome in robotics, even if all the worlds hardware and software was free you still have mountains to climb

its a funny ole game, basic robo hadware is cheap as chips, software can be free or just as cheap. The real price you pay is brain strain. WIth such narrow profit margins theres only so much a hardware or software supplier can afford to do for their customers. Brainstrain works both ways.

Thanks for the info, now i know where i am. I added the pic of my setup above, in case you where wondering what i was trying to do. (its a very large sentient brain that runs on a network , half a million lines of code 20+ Terrabytes of memory)

I need to build software bridge to a large array of hardware & sensors so it can sense our world… looks like the hardware is gonna be just as big a challenge as the software." just stepping outside, i may be a while" lol,

Brief overview of the brain

Why do you think the source code of the Maestro Control Center would help you? Which wheel does it contain that you have to reinvent?

It sounds like you want to write a program that:

  1. Detects new files in a folder.
  2. Opens each file parses the commands stored in them.
  3. Sends the commands to the Maestro.
  4. Removes the file?

We’ve provided you a simple, mostly open source, example program that does #3. The other tasks (1,2, and 4) are not part of the Maestro Control Center so seeing its code wouldn’t help you do those.