SHARE
TWEET

Contrôle retournement des oeufs servomoteur

vbprojects Oct 23rd, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Servo.h>
  2.  
  3. Servo monServo;
  4. int retournement = 3600000; //Retournement toutes les heures
  5. int degres = 45;
  6. const int servo = 11;
  7.  
  8. void setup() {
  9.   monServo.attach(servo);
  10.   //Remise à zéro du servomoteur
  11.   monServo.write(0);
  12. }
  13.  
  14. void loop() {
  15.   //Retournement phase 1
  16.   for(int i = 0; i <= degres; i++){
  17.     monServo.write(i);
  18.     delay(50);
  19.   }
  20.  delay(250);
  21.  //Retournement phase 2
  22.  for(int i = degres; i > 0; i--){
  23.     monServo.write(i);
  24.     delay(50);
  25.   }
  26.   monServo.detach();
  27.   //Attente
  28.  delay(retournement);
  29.  monServo.attach(servo);
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top