The actual servo controller should be arriving tomorrow or the next day.
If I get it working with MMF2 then of course I'll let everyone know how I did it (maybe write an article).
Is that what you're interested in, or just the bit about dlls?
Well, it arrived, but I'm having difficulty getting it to work.
I plugged in a 4.8V battery pack and servo (all wired up the correct way), and it just melted the servo before I even connected it to a computer
I am a retired clicker but I did do my degree in electronics and computer science and I worked as an embedded systems engineer for a while! Robotics is also one of my many hobbies, I am currently building a mini sumo robot and I have built a couple of micromices.
Anyhow from a very very brief read up on the board, it appears to offer a virtual COM port over USB. I have controlled embedded systems over USB from MMF2 using the Serial port object, it works very well!
The example application with it allows you to connect, send and receive. If it was me I would read up on the protocol and find the COM port the board is hiding on (device manager, it will probably come up something like Microchip CDC) and see if it responds to sending some commands.
You may need a bigger battery pack greater than 4.8V for PC less operation. If it is less than 5V and if it's a conventional regulator you will need greater than about 5.5 to 6V to beat the drop across the regulator - hence the microcontroller onboard would probably not be powered. 4.8 is fine for the motors, plugging in to USB should power up the micro as well as the motors.
Thanks for all the info - I'll look into that Arduino thing. It's cheap, which is nice
It's not actually for a robot as such - I just need to have 3 servos and 1 motor controlled by a laptop (so it pretty much has to be USB; bluetooth would be better but it's too expensive). It will be connected to the computer at all times.
I now have the controller working using the supplied software, so I at least know it's not broken, but no luck with the dll in MMF2. I'll look into using the serial connection, but the dll would have been better - don't suppose you have any ideas of how to get that working, do you?
Hi, I just had an quick peek through the source code and I think you should read the file: "Usc_protocol.cs" since that file defines the constants needed to communicate.
The file: "Usc.cs" holds the class which setups an object that represents the connection to the computer. Err well you probably figured this out yourself from the comments.
But it seems like this was setup to read, store and execute script files. So I would say: create a simple script file and figure out which functions are called from the class located in: "Usc.cs" because if the file: "UscSettings.cs" takes care from loading the settings and script(s?)
This function is "Usc.cs" loads the settings: "public void setUscSettings(UscSettings settings, bool newScript)"
And that's probably all I could do so far. Good luck with controlling your servo's. You could always control them by letting mmf create the little scripts for you and send it to the hardware. But it's some sort of intermediate solution.
Unfortunately I am in embedded programmer, I have dabbled in system programming (command line apps in C/C++ and a tiny bit of python) but Jenswa (Hi there fellow iklik-it dude , long time no see hope your well) and others in this thread I think have more experience on PC side than me. I work at the low levels close to hardware, so that's where I feel most comfortable .
I had a look at the Edwards protocol (http://www.seetron.com/ssc.htm) which the board also accepts. Its 3 bytes and is very simple!
Byte 1: Marker 0xFF (hex) or 255 in decimal (note this is not a sting of 255 but a single byte - one character)
Byte 2: Servo number from 0x00 to 0xFE (0 to 254)
Byte 3: Servo position from 0x00 to 0xFE (0 to 254 with 127 being centre)
I have modified the serial port example for MMF2 to send packets according to Edwards protocol, and I have emailed it you - it should get something working in a fashion if you can not figure the DLL approach out. Assuming Pololu are not fibbing about it being able to use either protocol, it should work. Find the com port the board is on, alter as necessary, then open the port (9600 baud should be fine). The little red indicator AO should go green if all is good!
Also note my example will only work from the second servo on and also you will lose one position increment at the one end. For testing just move the motor plug along the connector to the 2 nd position
This is due to a 0 character being a null terminator for strings. If this works you may be able to use the binary object (i.e. use 3 bytes and address them manually) then send a string from the binary object. I'm not sure about the serial object itself though, this maybe a limitation of using MMF - a null terminator is usually used to tell functions to stop reading characters (singular bytes) from this array (i.e. stop here no more data, unless you want to read out the end of the array and read god knows what ! ). As there is there no way to set the string length any other way I think that maybe a limitation.
Thank you very much for going to all that trouble to help me
Like you said, it does look like it ought to be quite simple using the serial object - but unfortunately, it doesn't seem to be working so far
Looking in Control Panel, the servo controller seems to use 2 COM ports:
Pololu Micro Maestro 6-Servo Controller Command Port (COM4)
Pololu Micro Maestro 6-Servo Controller TTL Port (COM5)
I've tried them both, but with no success.
I don't get an error message, and the circle goes green, but the servo just doesn't move.
I've tried plugging the servo into all the different channels.
I've also tried sending a "baud rate indication byte" as mentioned here: http://www.pololu.com/docs/0J40/5.c - don't really know what it's for, but I figured it was worth a try
If you have any other suggestions, feel free to let me know.
Otherwise, thanks again for the help you've already given me
At least I know who to give the servo controller to now, if I give up trying to make it work myself