Premier essai du ZX-Servo16U

Késako le ZX-Servo16U? C’est une petite carte fille qui permet de contrôler jusqu’à 16 Servo moteurs, le tout en n’occupant qu’un port sur votre contrôleur principal.

La fiche de description du produit par son constructeur.
Le PDF des specs.
Disponible chez RobotShop par exemple.

Une image veut mieux qu’un long discours:

servo2

J’ai posté une petite vidéo qui démontre une utilisation très basique:

Petit essai du ZX-Servo16U avec ma FEZ Cobra

Le programme est tout bête:

// Object controlling the Servo controller (IO74)
Servo16 servo16 = new Servo16(FEZ_Pin.Digital.IO74);
// Object controlling the button (IO12)
Button myButton = new Button(FEZ_Pin.Digital.IO12);
 
// Wait for the button to be pushed
while (myButton.GetState() != Button.ButtonState.Pressed)
{
	Thread.Sleep(10);
}
// Wait for the button to be released
while (myButton.GetState() == Button.ButtonState.Pressed)
{
	Thread.Sleep(10);
}
 
// Start the loop that will move the two servos
while (true)
{
	// Check for button pushed, exit if it's the case
	if (myButton.GetState() == Button.ButtonState.Pressed) break;
 
	// Set the servo at channel 0, with a ramp speed of 5, to the position 0°
	servo16.SetServoPosition(0, 5, 0);
				
	// Set the servo at channel 1, with a ramp speed of 5, to the position 0°
	servo16.SetServoPosition(1, 5, 0);
 
	// Wait for the operation to complete
	Thread.Sleep(1000);
 
	// Check for button pushed, exit if it's the case
	if (myButton.GetState() == Button.ButtonState.Pressed) break;
 
	// Set the servo at channel 0, with a ramp speed of 5, to the position 90°
	servo16.SetServoPosition(0, 5, 90);
	// Set the servo at channel 1, with a ramp speed of 5, to the position 30°
	servo16.SetServoPosition(1, 5, 30);
	Thread.Sleep(1000);
 
	// Now you can figure these lines out
	if (myButton.GetState() == Button.ButtonState.Pressed) break;
	servo16.SetServoPosition(0, 5, 180);
	servo16.SetServoPosition(1, 5, 120);
	Thread.Sleep(1000);
 
}
 
// Reset the position of bot
servo16.SetServoPosition(0, 5, 0);
servo16.SetServoPosition(1, 5, 0);

La classe Servo16 est développée par GHI, disponible ici: http://code.tinyclr.com/project/49/serial-servo-motor-controller/

Voilà, ce n’est pas sorcier et il y a de quoi faire avec 16 servos !