|
(Balise : Nouvelle redirection) |
Ligne 1 : |
Ligne 1 : |
− | {{Item
| + | #REDIRECTION [[Item:Capteur Fin de Course]] |
− | |Main_Picture=Item-End-Stop_Sensor_DSC_0059.JPG
| |
− | |Description=Interrupteur Fin de Course
| |
− | |Categories=Matériel, Parts
| |
− | |Cost=1.09
| |
− | |Currency=EUR (€)
| |
− | |ItemLongDescription={{Info|Il doit être alimenté en 5V}}
| |
− | | |
− | | |
− | plus d'infos :
| |
− | =Caractéristiques=
| |
− | | |
− | *alimentation maxi : 5V
| |
− | | |
− | <br />
| |
− | =Bibliothèque : =
| |
− | Pour utiliser facilement cet Interrupteur, nous vous conseillons d'utiliser la bibliothèque
| |
− | | |
− | ezButton (présente dans le gestionnaire de bibliothèques arduino)
| |
− | | |
− | plus d'infos pour [[Importer des bibliothèques dans l'interface Arduino]]
| |
− | <br />{{#annotatedImageLight:Fichier:Item-End-Stop Sensor Library.png|0=1031px|hash=|jsondata=|mediaClass=Image|type=frameless|alt=Item-End-Stop Sensor Library|align=center|src=https://www.wikidebrouillard.org/images/5/5f/Item-End-Stop_Sensor_Library.png|href=./Fichier:Item-End-Stop Sensor Library.png|resource=./Fichier:Item-End-Stop Sensor Library.png|caption=|size=1031px}}
| |
− | | |
− | | |
− | | |
− | La bibliothèque est disponible ici : https://github.com/ArduinoGetStarted/button
| |
− | =Câblage : =
| |
− | {{#annotatedImageLight:Fichier:Item-End-Stop Sensor.png|0=1041px|hash=|jsondata=|mediaClass=Image|type=frameless|alt=Item-End-Stop Sensor|align=center|src=https://www.wikidebrouillard.org/images/9/97/Item-End-Stop_Sensor.png|href=./Fichier:Item-End-Stop Sensor.png|resource=./Fichier:Item-End-Stop Sensor.png|caption=|size=1041px}}
| |
− | | |
− | | |
− | =Le code minimal : =
| |
− | {| class="wikitable" cellspacing="0" border="0"
| |
− | | height="17" bgcolor="#999999" align="left" |
| |
− | | valign="middle" bgcolor="#999999" align="center" |
| |
− | | bgcolor="#999999" align="center" |End-Stop Sensor
| |
− | |-
| |
− | | rowspan="2" valign="middle" height="49" bgcolor="#999999" align="center" |Avant le Setup
| |
− | | valign="middle" bgcolor="#999999" align="center" |Importation de la bibliothèque
| |
− | | valign="middle" align="left" |#include <ezButton.h>
| |
− | |-
| |
− | | valign="middle" bgcolor="#999999" align="center" |Création de l'objet et Configuration de la broche
| |
− | | valign="middle" align="left" |ezButton limitSwitch(7);
| |
− | |-
| |
− | | valign="middle" height="17" bgcolor="#999999" align="center" |Dans le Setup
| |
− | | valign="middle" bgcolor="#999999" align="center" |Configuration du temps de rebond
| |
− | | valign="middle" align="left" |limitSwitch.setDebounceTime(50);
| |
− | |-
| |
− | | valign="middle" height="41" bgcolor="#999999" align="center" |Dans le Loop
| |
− | | valign="middle" bgcolor="#999999" align="center" |Utilisation
| |
− | | valign="middle" align="left" |limitSwitch.loop();
| |
− | | |
− | if(limitSwitch.isPressed())
| |
− | | |
− | Serial.println("L'interrupteur de fin de course: NON TOUCHÉ -> TOUCHÉ");
| |
− | | |
− | if(limitSwitch.isReleased())
| |
− | | |
− | Serial.println("L'interrupteur de fin de course: TOUCHÉ -> NON TOUCHÉ");
| |
− | | |
− | int state = limitSwitch.getState();
| |
− | | |
− | if(state == HIGH)
| |
− | | |
− | Serial.println("L'interrupteur de fin de course: NON TOUCHÉ");
| |
− | | |
− | else
| |
− | | |
− | Serial.println("L'interrupteur de fin de course: TOUCHÉ");
| |
− | |}
| |
− | =Autres fonctionnalités=
| |
− | Aucune autres fonctionnalités
| |
− | =Exemple : =
| |
− | <syntaxhighlight lang="arduino" line="1" start="1">
| |
− | #include <ezButton.h>
| |
− | | |
− | ezButton limitSwitch(7); // créer un objet ezButton qui s'attache à la broche 7
| |
− | | |
− | void setup() {
| |
− | Serial.begin(9600);
| |
− | limitSwitch.setDebounceTime(50); // fixer le temps de rebond à 50 millisecondes
| |
− | | |
− | }
| |
− | | |
− | void loop() {
| |
− | limitSwitch.loop(); // DOIT appeler la fonction loop() en premier
| |
− | | |
− | if(limitSwitch.isPressed())
| |
− | Serial.println("L'interrupteur de fin de course: NON TOUCHÉ -> TOUCHÉ");
| |
− | | |
− | if(limitSwitch.isReleased())
| |
− | Serial.println("L'interrupteur de fin de course: TOUCHÉ -> NON TOUCHÉ");
| |
− | | |
− | int state = limitSwitch.getState();
| |
− | if(state == HIGH)
| |
− | Serial.println("L'interrupteur de fin de course: NON TOUCHÉ");
| |
− | else
| |
− | Serial.println("L'interrupteur de fin de course: TOUCHÉ");
| |
− | | |
− | }
| |
− | | |
− | </syntaxhighlight><span> </span>
| |
− | }}
| |
− | {{Tuto Status
| |
− | |Complete=Published
| |
− | }}
| |