(Page créée avec « {{Item |Main_Picture=Item-Vibration_Sensor_SW-420_sw-420.jpg |Description=Capteur de vibration |Categories=Matériel, Parts |Cost=0.55 |Currency=EUR (€) }} {{Tuto Status... ») |
|||
| (5 révisions intermédiaires par 2 utilisateurs non affichées) | |||
| Ligne 5 : | Ligne 5 : | ||
|Cost=0.55 | |Cost=0.55 | ||
|Currency=EUR (€) | |Currency=EUR (€) | ||
| + | |ItemLongDescription={{Info|Il doit être alimenté en 5V}} | ||
| + | |||
| + | |||
| + | |||
| + | plus d'infos sur [https://pdf1.alldatasheet.fr/datasheet-pdf/view/652087/ETC2/SW-420.html la notice du composant "datasheet".] | ||
| + | =Caractéristiques= | ||
| + | |||
| + | *alimentation maxi : 5V | ||
| + | |||
| + | <br /> | ||
| + | =Bibliothèque : = | ||
| + | Pour utiliser le capteur de vibration il n'y a besoin d'aucunes bibliothèques | ||
| + | =Câblage : = | ||
| + | <br />{{#annotatedImageLight:Fichier:Item Vibration Sensor SW420.png|0=971px|hash=|jsondata=|mediaClass=Image|type=frameless|alt=Item Vibration Sensor SW420|align=center|src=https://www.wikidebrouillard.org/images/c/ce/Item_Vibration_Sensor_SW420.png|href=./Fichier:Item Vibration Sensor SW420.png|resource=./Fichier:Item Vibration Sensor SW420.png|caption=|size=971px}}<br /> | ||
| + | =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" |Vibration Sensor SW-420 | ||
| + | |- | ||
| + | | 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" |Aucunes bibliothèques | ||
| + | |- | ||
| + | | valign="middle" bgcolor="#999999" align="center" |Création des variables | ||
| + | | valign="middle" align="left" |int Vibration_signal = 7; | ||
| + | int Sensor_state = 1; | ||
| + | |- | ||
| + | | valign="middle" height="17" bgcolor="#999999" align="center" |Dans le Setup | ||
| + | | valign="middle" bgcolor="#999999" align="center" |Configuration de la broche | ||
| + | | valign="middle" align="left" |pinMode(Vibration_signal, INPUT); | ||
| + | |- | ||
| + | | valign="middle" height="41" bgcolor="#999999" align="center" |Dans le Loop | ||
| + | | valign="middle" bgcolor="#999999" align="center" |Utilisation | ||
| + | | valign="middle" align="left" |Serial.print("État des vibrations : "); | ||
| + | |||
| + | Sensor_state = digitalRead(Vibration_signal); | ||
| + | |||
| + | if (Sensor_state == 1) { | ||
| + | |||
| + | Serial.println("Détection des vibrations"); | ||
| + | |||
| + | } else { | ||
| + | |||
| + | Serial.println("Pas de vibration"); | ||
| + | |||
| + | } | ||
| + | |||
| + | delay(50); | ||
| + | |} | ||
| + | =Autres fonctionnalités= | ||
| + | Aucune autres fonctionnalités | ||
| + | =Exemple : = | ||
| + | <syntaxhighlight lang="arduino" line="1" start="1"> | ||
| + | int Vibration_signal = 7; | ||
| + | int Sensor_state = 1; | ||
| + | |||
| + | void setup() { | ||
| + | pinMode(Vibration_signal, INPUT); | ||
| + | Serial.begin(9600); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | Serial.print("État des vibrations : "); | ||
| + | Sensor_state = digitalRead(Vibration_signal); | ||
| + | if (Sensor_state == 1) { | ||
| + | Serial.println("Détection des vibrations"); | ||
| + | } else { | ||
| + | Serial.println("Pas de vibration"); | ||
| + | } | ||
| + | delay(50); | ||
| + | } | ||
| + | </syntaxhighlight><span> </span> | ||
}} | }} | ||
{{Tuto Status | {{Tuto Status | ||
| − | |Complete= | + | |Complete=Published |
}} | }} | ||
plus d'infos sur la notice du composant "datasheet".
Pour utiliser le capteur de vibration il n'y a besoin d'aucunes bibliothèques
| Vibration Sensor SW-420 | ||
| Avant le Setup | Importation de la bibliothèque | Aucunes bibliothèques |
| Création des variables | int Vibration_signal = 7;
int Sensor_state = 1; | |
| Dans le Setup | Configuration de la broche | pinMode(Vibration_signal, INPUT); |
| Dans le Loop | Utilisation | Serial.print("État des vibrations : ");
Sensor_state = digitalRead(Vibration_signal); if (Sensor_state == 1) { Serial.println("Détection des vibrations"); } else { Serial.println("Pas de vibration"); } delay(50); |
Aucune autres fonctionnalités
int Vibration_signal = 7;
int Sensor_state = 1;
void setup() {
pinMode(Vibration_signal, INPUT);
Serial.begin(9600);
}
void loop() {
Serial.print("État des vibrations : ");
Sensor_state = digitalRead(Vibration_signal);
if (Sensor_state == 1) {
Serial.println("Détection des vibrations");
} else {
Serial.println("Pas de vibration");
}
delay(50);
}Item-Vibration_Sensor_SW-420_sw-420.jpg Published
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #