Modifications

Sauter à la navigation Sauter à la recherche
Ligne 132 : Ligne 132 :  
# Create the stepper motor object with '''AF_Stepper(steps, stepper#)''' to setup the motor H-bridge and latches.'' '''Steps''' '' indicates how many steps per revolution the motor has. a 7.5degree/step motor has 360/7.5 = 48 steps.'' '''Stepper#''' '' is which port it is connected to. If you're using M1 and M2, its port 1. If you're using M3 and M4 its port 2
 
# Create the stepper motor object with '''AF_Stepper(steps, stepper#)''' to setup the motor H-bridge and latches.'' '''Steps''' '' indicates how many steps per revolution the motor has. a 7.5degree/step motor has 360/7.5 = 48 steps.'' '''Stepper#''' '' is which port it is connected to. If you're using M1 and M2, its port 1. If you're using M3 and M4 its port 2
 
# Set the speed of the motor using '''setSpeed(rpm)''' where '' '''rpm''' '' is how many revolutions per minute you want the stepper to turn.
 
# Set the speed of the motor using '''setSpeed(rpm)''' where '' '''rpm''' '' is how many revolutions per minute you want the stepper to turn.
# Then every time you want the motor to move, call the '''step(#steps, direction, steptype)''' procedure. '' '''#steps''' '' is how many steps you'd like it to take. direction is either '''FORWARD''' or '''BACKWARD''' and the step type is '''SINGLE, DOUBLE. INTERLEAVE''' or '''MICROSTEP'''.
+
# Then every time you want the motor to move, call the '''step(#steps, direction, steptype)''' procedure. '' '''#steps''' '' is how many steps you'd like it to take. direction is either '''FORWARD''' or '''BACKWARD''' and the step type is '''SINGLE, DOUBLE. INTERLEAVE''' or '''MICROSTEP'''.<br />"Single" means single-coil activation, "double" means 2 coils are activated at once (for higher torque) and "interleave" means that it alternates between single and double to get twice the resolution (but of course its half the speed). "Microstepping" is a method where the coils are PWM'd to create smooth motion between steps. [http://www.ladyada.net/make/mshield/resources.html Theres tons of information about the pros and cons of these different stepping methods in the resources page].<br />You can use whichever stepping method you want, changing it "on the fly" to as you may want minimum power, more torque, or more precision.
    "Single" means single-coil activation, "double" means 2 coils are activated at once (for higher torque) and "interleave" means that it alternates between single and double to get twice the resolution (but of course its half the speed). "Microstepping" is a method where the coils are PWM'd to create smooth motion between steps. [http://www.ladyada.net/make/mshield/resources.html Theres tons of information about the pros and cons of these different stepping methods in the resources page].<br />
  −
You can use whichever stepping method you want, changing it "on the fly" to as you may want minimum power, more torque, or more precision.
   
# By default, the motor will 'hold' the position after its done stepping. If you want to release all the coils, so that it can spin freely, call '''release()'''
 
# By default, the motor will 'hold' the position after its done stepping. If you want to release all the coils, so that it can spin freely, call '''release()'''
 
# The stepping commands are 'blocking' and will return once the steps have finished. If someone wants to be awesome and write a version of the library that does background stepping that would be cool! :)
 
# The stepping commands are 'blocking' and will return once the steps have finished. If someone wants to be awesome and write a version of the library that does background stepping that would be cool! :)
    
  <nowiki>#include <AFMotor.h>
 
  <nowiki>#include <AFMotor.h>
      
AF_Stepper motor(48, 2);
 
AF_Stepper motor(48, 2);
      
void setup() {
 
void setup() {
Ligne 177 : Ligne 173 :  
   }
 
   }
 
}</nowiki>
 
}</nowiki>
       
29 917

modifications

Menu de navigation