Thank
Ben, I have tried with your code for servo off. It works, with less coding.
This is what I have done so far.
16 usb servo.
I can set the max speed baud of 57600.
The servo can move right and left.
The servo can turn off.
I still have two questions
1)
For speed setting.
I set 0 for fastest and 127 for slowest.
To be honest it look like both goes the same speed.
0 and 100,127 speed setting…
To my eyes they all seem to go at the same speed.
I have tried with my brother Hitec servo
475
5475
645
77
805
5990
5980
Did I do the code wrong.
string data1Hex = data1.ToString(“X”);
byte data1Byte=byte.Parse(data1Hex,System.Globalization.NumberStyles.HexNumber);
string ServoSpeedHex = ServoSpeed.ToString(“X”);
byte SpeedByte = byte.Parse(ServoSpeedHex,System.Globalization.NumberStyles.HexNumber);
string ServoNumberHex = ServoNumber.ToString(“X”);
byte ServoNumberByte = byte.Parse(ServoNumberHex, System.Globalization.NumberStyles.HexNumber);
//first send SPEED command
port.Write(new byte[] {
0x80, //synch value (always 0x80)
0x01, //device ID (0x01 for 16 usb servo controller)
0x01, //servo command (setting speed is command 1)
ServoNumberByte, //servo number
SpeedByte, //Data Byte 1: Speed. 0 = instant, 1-127 accel control (0 = quickest, 127 = slowest)
//Data Byte 2: Unnecessary for setting speed.
}, 0, 5);
//second, send ABSOLUTE POSITION command
port.Write(new byte[] {
0x80, //synch value (always 0x80)
0x01, //device ID (0x01 for 16 usb servo controller)
0x04, //servo command (command 4 == Absolute Position (2bytes) )
ServoNumberByte, //servo number
upperBitsByte, //Data Byte 1: This byte is composed of the
lowerBitsByte
}, 0, 6);
port.Close();
- My second question.
Can we store the final motion sequences into pololu controller memory so that we don:t have to use the computer.