From 99ef9a4f4ab0494be2647c5510ed986b22e3faf1 Mon Sep 17 00:00:00 2001 From: shrkey Date: Tue, 27 Sep 2016 21:25:39 +0100 Subject: [PATCH] servo docs --- 640.md | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/640.md b/640.md index 2bc7670..7b4682f 100644 --- a/640.md +++ b/640.md @@ -3,7 +3,15 @@ The 640 board is used to drive up to 6 DC motors and 2 Servo motors. ## Getting started + +![640](/images/640-450.png) + +Welcome to the 640 board - this guide will describe all the features of the 640 board and show you how to control up to 6 motors or 3 stepper motors very simply. + ## Board layout + + + ## Setup ### Attaching the power ### Attaching a Servo @@ -179,10 +187,48 @@ m1.setMotorSpeed(1250) #### Select a Servo -There are two servo ports on the 640 board +There are two servo ports on the 640 board. They are numbered 1 and 2 with number 1 to the left hand side and number 2 the closest to the motor ports. + +You select a servo in the same manner as you select motors, by requesting a servo object from the controller - to select the first servo we use: + +``` python +s1 = dw.getServo(1) +``` #### Servo control +Once you have a servo object there are currently three commands you can run. + +##### off() + +The off command will switch off your servo and stop any signals being sent to it. + +``` python +s1.off() +``` + +##### setPWMuS( *microseconds* ) + +This command will allow you to set the PWM pulse to the Servo in microseconds. + +Most standard servos use a parameter value of 1000 for fully counter-clockwise, 2000 for fully clockwise, and 1500 for the middle - though you may have a wider range on your servo, so you should check the technical documentation for it to get the finer details. + +``` python +s1.setPWMuS(1500) # middle +s1.setPWMuS(2000) # fully clockwise +s1.setPWMuS(1000) # fully counter clockwise +``` + +##### setPWMmS( *milliseconds* ) + +This command allows you to specify the PWM pulse in milliseconds rather than seconds. + +``` python +s1.setPWMmS(1.5) # middle +s1.setPWMmS(2.0) # fully clockwise +s1.setPWMmS(1.0) # fully counter clockwise +``` + #### Select a Stepper motor You can control up to 3 stepper motors with the 640 board - each stepper motor uses two motor ports for 4 wire stepper motors and three motor ports for 5 wire stepper motors.