====== Sculpture Moteur pas a pas ====== * Porteur du projet : P cheaoum * Fichiers utiles : //mettre un lien vers un code ou un fichier// {{tag>stepper, arduino}} ===== Note d'intention ===== Faire tourner un chassis avec 3 peintures avec un moteur pas à pas. {{@@Image@@?800|Sculpture Moteur pas a pas}} ==== Références et liens ==== * Notez ici les références artistiques et techniques, ou autres influences * * ===== Notes techniques et matériaux ===== Liste de matériel et composants nécessaires (documents avec photo si possible...) #define btnPin 6 // Define pin connections & motor's steps per revolution const int dirPin = 2; const int stepPin = 3; const int stepsPerRevolution = 200/3; int stepDelay=4000; uint8_t btn_prev; void setup() { // Declare pins as Outputs pinMode(btnPin, INPUT_PULLUP); pinMode(stepPin, OUTPUT); pinMode(dirPin, OUTPUT); btn_prev = digitalRead(btnPin); } void loop() { uint8_t btn = digitalRead(btnPin); if (btn == LOW && btn_prev == HIGH) { //clockwise digitalWrite(dirPin, HIGH); // Spin motor for(int x = 0; x < stepsPerRevolution; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(stepDelay); digitalWrite(stepPin, LOW); delayMicroseconds(stepDelay); } delay(1000); // Wait a second } btn_prev = digitalRead(btnPin); } ===== Photos et médias===== Code pour afficher les images du projet : {{gallery>?&crop&lightbox }}