Tags:
view all tags
---+ Les interrupteurs ---++ Introduction Dans notre kit nous avons 4 types de dispositifs qui peuvent servir d'interrupteur : * l'interrupteur mécanique simple (push button) * le clavier à 16 touches * le détecteur infrarouge passif (PIR: <b>P</b>assive<b> I</b>nfra<b>R</b>ed Sensor) * le détecteur tactile capacitif | <img alt="pushbuttton.png" height="204" src="%ATTACHURL%/pushbuttton.png" title="pushbuttton.png" width="234" /> | <img alt="keypad.png" height="312" src="%ATTACHURL%/keypad.png" title="keypad.png" width="430" /> | <img alt="pir.png" height="334" src="%ATTACHURL%/pir.png" title="pir.png" width="395" /> | | interrupteur mécanique | clavier 16 touches | capteur PIR | ---++ L'interrupteur mécanique Si on pousse le bouton d'interruption un contact est établi et un courant peut passer à travers le bouton. Si le bouton est relâché le circuit est interrompu. On peut connecter un tel bouton à un pin GPIO, programmé en entrée avec une résistance "pull-up" également programme. L'autre pin du bouton et mis à la masse. On lit une valeur de "1" si le bouton est relâché (la tension Vcc appliqué via la résistance "pull-up" et zéro si le bouton est pressé. L'interrupteur mécanique a le problème que les transitions sont généralement pas propre. Pendent quelques ms son état peut sauter entre zéro et un avant de se stabiliser. On appelle cet effet "switch bouncing" et vous allez trouver sur Internet plusieurs solutions hardware et software pour se débarrasser de ce problème. Pour lire l'état de l'interrupteur on peut écrire une boucle qui lit la valeur du pin GPIO en intervalles réguliers (polling) ou on peut créer une interruption quand l'état du pin GPIO change. Dans ce cas !MicroPython appelle une fonction "callback" ou "interrupt service routine" précédemment définie par le programmeur et enregistré avec la déclaration de l'interruption. -- %USERSIG{UliRaich - 2021-06-21}% ---++ Comments %COMMENT%
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
png
keypad.png
r1
manage
91.4 K
2021-06-21 - 07:59
UliRaich
png
pir.png
r1
manage
143.3 K
2021-06-21 - 07:59
UliRaich
png
pushbuttton.png
r1
manage
48.1 K
2021-06-21 - 07:59
UliRaich
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2021-06-21
-
UliRaich
Home
Site map
AFNOG web
Embedded_Systems web
IoT_Course_English web
IoT_Course_French web
Main web
Sandbox web
TWiki web
IoT_Course_French Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
Edit
Attach
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback