#include <Stepper.h>
const int stepsPerRevolution = 200; // Nombre de pas par révolution
// Initialisation de la bibliothèque Stepper sur les broches :
Stepper myStepper(60, 12, 14, 27, 26);
void setup() {
// set the speed at 30 rpm:
myStepper.setSpeed(30);
// initialize the serial port:
Serial.begin(9600);
Serial.print("Initialisation");
}
void loop() {
if (Serial.available()) { // Données sont disponibles sur le port série Bluetooth
char Rx = Serial.read(); // read data from serial port
if (Rx == 'h') {
myStepper.step(-5); // rotation moteur anti horaire
} else if (Rx == 'b') {
myStepper.step(5); // rotation moteur horaire
}
}
}