Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| projets:pasdesens [2024/04/14 13:28] – etudiant_e | projets:pasdesens [2024/05/23 09:47] (Version actuelle) – etudiant_e | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== | + | ======ArduinoHC-SR04====== |
| Cette année a été prédominé par une facette/ | Cette année a été prédominé par une facette/ | ||
| Me sentant bloquée par cette facette, j’ai voulu l’exprimer et la rendre utile en l’utilisant pour mon sujet d’inspiration créatif cette année. | Me sentant bloquée par cette facette, j’ai voulu l’exprimer et la rendre utile en l’utilisant pour mon sujet d’inspiration créatif cette année. | ||
| - | + | Overthinking you know lol | |
| - | Overthinking you know lol | + | |
| Pour cela, j'ai imaginé une installation. | Pour cela, j'ai imaginé une installation. | ||
| - | Extérieurement composé en tissu (matière/ | + | Extérieurement composé en tissu (matière/ |
| Expérimenté en cours de programmation, | Expérimenté en cours de programmation, | ||
| + | ---- | ||
| + | J’établis donc que le projet pour ce cours d' | ||
| + | **// | ||
| + | |||
| + | *https:// | ||
| + | {{projets: | ||
| + | |||
| + | |||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | {{projets: | ||
| + | |||
| + | * Pour le schéma Hardware j'ai utiliser https:// | ||
| + | facile à comprendre et gratuit. | ||
| ---- | ---- | ||
| - | J’établis donc que le projet | + | TT c recherche |
| - | Pour cela... | + | |
| **//Matos ://** | **//Matos ://** | ||
| Ligne 38: | Ligne 51: | ||
| //code;// | //code;// | ||
| - | kdo{{projets: | + | *kdo{{projets: |
| {{projets: | {{projets: | ||
| (moyen des 3 HCSR04 pour la variation du volume) | (moyen des 3 HCSR04 pour la variation du volume) | ||
| + | ->ce code est devenu bancale, j'ai donc changé de librairie et fais autrement: | ||
| - | //**Résultat; | + | * New code |
| + | #include < | ||
| + | #include " | ||
| + | #include < | ||
| + | SoftwareSerial softSerial(/*rx =*/4, /*tx =*/5); | ||
| + | #define FPSerial softSerial | ||
| - | {{MP4}} | + | DFRobotDFPlayerMini myDFPlayer; |
| - | [[http:// | + | |
| - | **//reSources ://** | + | HCSR04 hc(2, new int[3] {8, 9, 10}, 3); //initialisation class HCSR04 (trig pin , echo pin, number of sensor) |
| - | *https:// | + | int ActVol = 0; |
| - | {{projets: | + | int NewVol = 0; |
| + | double distance_cm, | ||
| + | int samples = 3 ; | ||
| + | boolean Debug = true ; | ||
| - | * https:// | ||
| - | * https:// | ||
| - | {{projets:creer_du_son_avec_le_dfplayer_mini_mp3.mp4}} | + | void setup() { |
| + | Serial.begin(9600); | ||
| + | FPSerial.begin(9600); | ||
| + | if (!myDFPlayer.begin(FPSerial, | ||
| + | while (true) { | ||
| + | delay(0); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | myDFPlayer.volume(0); | ||
| + | myDFPlayer.loop(1); | ||
| + | delay(2000); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | |||
| + | // Lecture des distances des capteurs | ||
| + | |||
| + | float c1_distance = hc.dist(0) ; | ||
| + | float c2_distance = hc.dist(1) ; | ||
| + | float c3_distance = hc.dist(2) ; | ||
| + | |||
| + | if (c1_distance == 0.0 ) { | ||
| + | c1_distance = 400; | ||
| + | } | ||
| + | if (c2_distance == 0.0 ) { | ||
| + | c2_distance = 400; | ||
| + | } | ||
| + | if (c3_distance == 0.0 ) { | ||
| + | c3_distance = 400; | ||
| + | } | ||
| + | |||
| + | // Serial.print(c1_distance); | ||
| + | // Serial.print(" | ||
| + | // Serial.print(c2_distance); | ||
| + | // Serial.print(" | ||
| + | // Serial.println(c3_distance); | ||
| + | |||
| + | // Détermination de la distance minimale | ||
| + | float min_distance = min(c2_distance, | ||
| + | // Réglage du volume en fonction de la distance minimale | ||
| + | |||
| + | NewVol | ||
| + | |||
| + | while (NewVol != ActVol) { | ||
| + | Serial.print(min_distance); | ||
| + | Serial.print(" | ||
| + | Serial.print(NewVol); | ||
| + | Serial.print(" | ||
| + | if (NewVol - ActVol > 0) { | ||
| + | ActVol++; | ||
| + | Serial.println(ActVol); | ||
| + | } | ||
| + | else { | ||
| + | ActVol--; | ||
| + | Serial.println(ActVol); | ||
| + | } | ||
| + | |||
| + | myDFPlayer.volume(ActVol); | ||
| + | |||
| + | } | ||
| + | delay(100); | ||
| + | } | ||
| + | |||
| + | // | ||
| + | {{projets:img_3513.mp4}} | ||
| - | * Pour le schéma Hardware j'ai utiliser https:// | ||
| - | facile à comprendre et gratuit. | ||
| ---- | ---- | ||
| Aussi non, ma premier idée pour ce cours étais d' | Aussi non, ma premier idée pour ce cours étais d' | ||
| :) | :) | ||
| - | |||
| ---- | ---- | ||
| B1 2024 A.VDS | B1 2024 A.VDS | ||