Outils pour utilisateurs

Outils du site


wiki:projets:lien_du_code_5

Code pousse seringue



#include <Stepper.h>
 
int enA  = 3;  // Enable pin 1 on Motor Control Shield   
int enB  = 11;  // Enable pin 2 on Motor Control Shield   
int dirA = 12;  // Direction pin dirA on Motor Control Shield
int dirB = 13;  // Direction pin dirB on Motor Control Shield
 
 
const int stepsPerRevolution = 400;  // Change this to fit the number of steps per revolution
                                     // for your motor
 
// Initialize the stepper library on pins 12 and 13:
Stepper myStepper(stepsPerRevolution, dirA, dirB);            
 
 
void setup() {
  // set the speed at 60 rpm:
  myStepper.setSpeed(60);
 
  // Enable power to the motor
  pinMode(enA, OUTPUT);
  digitalWrite (enA, HIGH);
 
  pinMode(enB, OUTPUT);
  digitalWrite (enB, HIGH);  
}
 
void loop() {
  // Step five revolutions into one direction:
 
 myStepper.step(-stepsPerRevolution*10);
  delay(2000);   
 
  myStepper.step(stepsPerRevolution*10);
  delay(2000);
 
  // Step five revolutions in the other direction:
 
}
wiki/projets/lien_du_code_5.txt · Dernière modification: 2017/03/14 10:25 de CASANOVA Oceane