(Djbrown a déplacé la page Item:Tilt Sensor SW-520D vers Item:Capteur d'inclinaison SW-520D) (Balise : Nouvelle redirection) |
m (Djbrown a déplacé la page Item:End-Stop Sensor vers Item:Capteur Fin de Course) |
||
Ligne 1 : | Ligne 1 : | ||
− | + | {{Item | |
+ | |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 | ||
+ | }} |
plus d'infos :
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
La bibliothèque est disponible ici : https://github.com/ArduinoGetStarted/button
End-Stop Sensor | ||
Avant le Setup | Importation de la bibliothèque | #include <ezButton.h> |
Création de l'objet et Configuration de la broche | ezButton limitSwitch(7); | |
Dans le Setup | Configuration du temps de rebond | limitSwitch.setDebounceTime(50); |
Dans le Loop | Utilisation | 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É"); |
Aucune autres fonctionnalités
1 #include <ezButton.h>
2
3 ezButton limitSwitch(7); // créer un objet ezButton qui s'attache à la broche 7
4
5 void setup() {
6 Serial.begin(9600);
7 limitSwitch.setDebounceTime(50); // fixer le temps de rebond à 50 millisecondes
8
9 }
10
11 void loop() {
12 limitSwitch.loop(); // DOIT appeler la fonction loop() en premier
13
14 if(limitSwitch.isPressed())
15 Serial.println("L'interrupteur de fin de course: NON TOUCHÉ -> TOUCHÉ");
16
17 if(limitSwitch.isReleased())
18 Serial.println("L'interrupteur de fin de course: TOUCHÉ -> NON TOUCHÉ");
19
20 int state = limitSwitch.getState();
21 if(state == HIGH)
22 Serial.println("L'interrupteur de fin de course: NON TOUCHÉ");
23 else
24 Serial.println("L'interrupteur de fin de course: TOUCHÉ");
25
26 }
Item-End-Stop_Sensor_DSC_0059.JPG Published
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #