(Page créée avec « {{Tuto Details |Main_Picture=Les_balistos_b7b5d236-1220-4baf-8b32-3fb80339143a.JPG |Licences=Attribution (CC-BY) |Description=L'objet est une catapulte réalisé à partir... ») |
|||
Ligne 1 : | Ligne 1 : | ||
− | {{ | + | {{Item |
− | |Main_Picture= | + | |Main_Picture=Item-Vibration_Sensor_SW-420_sw-420.jpg |
− | + | |Description=Capteur de vibration | |
− | |Description= | + | |Categories=Matériel, Parts |
− | | | + | |Cost=0.55 |
− | | | + | |Currency=EUR (€) |
− | | | + | |ItemLongDescription={{Info|Il doit être alimenté en 5V}} |
− | + | ||
− | | | + | |
− | }} | + | |
− | + | plus d'infos : https://pdf1.alldatasheet.fr/datasheet-pdf/view/652087/ETC2/SW-420.html | |
− | + | =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 : = | |
− | |Item= | + | {| 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 | |
− | |Item= | + | |- |
− | + | | 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("Vibration status: "); |
− | | | + | |
− | + | Sensor_state = digitalRead(Vibration_signal); | |
− | + | ||
− | | | + | if (Sensor_state == 1) { |
− | | | + | |
− | | | + | Serial.println("Sensing vibration"); |
− | | | ||
− | |||
− | |||
− | | | ||
− | | | ||
− | | | ||
− | + | } else { | |
− | |||
− | + | Serial.println("No 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 : https://pdf1.alldatasheet.fr/datasheet-pdf/view/652087/ETC2/SW-420.html
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("Vibration status: ");
Sensor_state = digitalRead(Vibration_signal); if (Sensor_state == 1) { Serial.println("Sensing vibration"); } else { Serial.println("No vibration"); } delay(50); |
Aucune autres fonctionnalités
1 int Vibration_signal = 7;
2 int Sensor_state = 1;
3
4 void setup() {
5 pinMode(Vibration_signal, INPUT);
6 Serial.begin(9600);
7 }
8
9 void loop() {
10 Serial.print("État des vibrations : ");
11 Sensor_state = digitalRead(Vibration_signal);
12 if (Sensor_state == 1) {
13 Serial.println("Détection des vibrations");
14 } else {
15 Serial.println("Pas de vibration");
16 }
17 delay(50);
18 }
Item-Vibration_Sensor_SW-420_sw-420.jpg Published
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #