Différences entre versions de « Projets:Finger Starter »

De wikilab
Ligne 41 : Ligne 41 :
  
  
* 1 - Joystick
+
* 1 - Boutton
  
 
<pre>
 
<pre>
exemple
+
#include <Servo.h>
  
blabla
+
Servo myservo;                      // create servo object to control a servo
  
jddad
+
const int servoPin = 9;            // Digital PWM used to control the servo
 +
const int buttonPin = 8;            // Digital pin used to control the button
  
azdazd
+
int val = 0;                        // variable to read the value from the button
 
 
{}
 
  
 +
void setup() {
 +
  myservo.attach(servoPin);        // attaches the servo to "servoPin"
 +
}
  
 +
void loop() {
 +
  val = digitalRead(buttonPin);    // gets button current state
 +
  if (val == 0) {                  // checks if the button is pressed
 +
    myservo.write(120);            // lifts finger
 +
  }
 +
  else {
 +
    myservo.write(10);              // lowers finger
 +
  }
 +
  delay(50);                        // waits for servo to get there
 +
}
 
</pre>
 
</pre>
  

Version du 26 mars 2021 à 11:35

Description du projet

Le projet est de réaliser un finger starter proposé par Inmoov : finger starter

Cahier des charges

Utiliser un kit de capteurs afin de contrôler le finger starter de manière originale.

Analyse de l'existant

http://inmoov.fr/finger-starter/

Equipe (Porteur de projet et contributeurs)

  • Concepteurs/contributeurs : Alix
  • Fabmanager référent : Yo
  • Responsable de documentation : Yo

Matériel nécessaire


Outils nécessaires

  • Un ordinateur

Coût

  • - de 50€

Fichiers source

finger starter


Image des différentes versions réalisée avec le code correspondant

  • 1 - Boutton
#include <Servo.h>

Servo myservo;                      // create servo object to control a servo

const int servoPin = 9;             // Digital PWM used to control the servo
const int buttonPin = 8;            // Digital pin used to control the button

int val = 0;                        // variable to read the value from the button

void setup() {
  myservo.attach(servoPin);         // attaches the servo to "servoPin"
}

void loop() {
  val = digitalRead(buttonPin);     // gets button current state 
  if (val == 0) {                   // checks if the button is pressed
    myservo.write(120);             // lifts finger
  }
  else {
    myservo.write(10);              // lowers finger
  }
  delay(50);                        // waits for servo to get there
}