Wiki

Reso-nance numérique | Arts et cultures libres

Outils du site


projets:totem:recherches

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
Dernière révision Les deux révisions suivantes
projets:totem:recherches [2021/11/08 11:40]
resonance créée
projets:totem:recherches [2021/11/11 18:32]
resonance [tests optiques : angles vs perte de luminosité]
Ligne 10: Ligne 10:
  
  
 +===== DEVELOPPEMENT ELECTRONIQUE =====
 +{{:projets:totem:totem-dev-electro1.png|}}
 ===== PISTES CREATIVES ===== ===== PISTES CREATIVES =====
  
Ligne 62: Ligne 64:
 === Structure Aluminium === === Structure Aluminium ===
 [[https://www.sodeficoncept.fr/fr/lean-modulaire/composants|Sodefi 35mm]] [[https://www.sodeficoncept.fr/fr/lean-modulaire/composants|Sodefi 35mm]]
-===ARDUINO ULN2003 STEPPER SIMPLE===+===ARDUINO ULN2003 STEPPER BI-DIRECTIONNAL===
 ++++ code stepper.h| ++++ code stepper.h|
 <code java> <code java>
Ligne 69: Ligne 71:
 Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11); Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);
  
 +int currentVal;
 +int lastVal;
 +int motorSpeed;
 + 
 void setup() { void setup() {
 +  Serial.begin(9600);
 } }
 + 
 void loop() { void loop() {
-  int sensorReading = analogRead(A0); +  int currentval = analogRead(A0); 
-  int motorSpeed = map(sensorReading, 0, 1023, 0, 100); +  if (currentval >= lastVal + 5 || currentVal <= lastVal + 5) 
-  if (motorSpeed > 0) { +  { 
-      myStepper.setSpeed( motorSpeed); +    motorSpeed = map(currentval, 0, 1023, 0, 100); 
-      myStepper.step(stepsPerRevolution / 100);+    Serial.println(motorSpeed);
   }   }
 +  lastVal = currentVal;
      
 +  if (motorSpeed < 49) {
 +      myStepper.setSpeed( 49 - motorSpeed);
 +      myStepper.step(stepsPerRevolution / 100);
 +  }
 +  else if (motorSpeed > 51) {
 +      myStepper.setSpeed( motorSpeed - 51);
 +      myStepper.step(-stepsPerRevolution / 100);
 +  }
 } }
 </code> </code>
/home/resonancg/www/wiki/data/pages/projets/totem/recherches.txt · Dernière modification: 2022/03/29 19:28 de resonance