cielmonprintemps
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 | ||
cielmonprintemps [2024/03/06 21:17] – [Code] Mushussu | cielmonprintemps [2024/04/29 14:23] (Version actuelle) – [Streaming] Mushussu | ||
---|---|---|---|
Ligne 8: | Ligne 8: | ||
[[https:// | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | ===== Interface ===== | ||
+ | Nous utilisons TouschOSC pour effectuer les réglages. en fonction des lieux. Voici le fichier de configuration pour {{ : | ||
+ | |||
+ | Il faut ensuite télécharger [[https:// | ||
+ | |||
+ | ===== Streaming ===== | ||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [http:// | ||
+ | |||
+ | [[https:// | ||
===== Code ===== | ===== Code ===== | ||
+ | |||
+ | ==== Code Arduino station météo ==== | ||
+ | <code cpp> | ||
+ | #include < | ||
+ | #include " | ||
+ | |||
+ | #define anemometre A2 | ||
+ | #define PI_4 0.78539816339 | ||
+ | #define PI_2 1.5707963267948966192313216916398 | ||
+ | #define PI3_4 2.35619449019 | ||
+ | #define PI 3.1415926535897932384626433832795 | ||
+ | #define PI5_4 3.92699081699 | ||
+ | #define PI3_2 4.71238898038 | ||
+ | #define PI7_4 5.49778714378 | ||
+ | |||
+ | |||
+ | int status = WL_IDLE_STATUS; | ||
+ | // Le nom du réseau et le mot de passe sont stockés dans le fichier arduino_secrets.h | ||
+ | char ssid[] = SECRET_SSID; | ||
+ | char pass[] = SECRET_PASS; | ||
+ | |||
+ | WiFiUDP Udp; | ||
+ | |||
+ | // Définition de l' | ||
+ | IPAddress serveurIp(192, | ||
+ | unsigned int serveurPort = 7000; | ||
+ | |||
+ | // définition du port local | ||
+ | unsigned int localPort = 7001; | ||
+ | |||
+ | unsigned long temps; | ||
+ | bool etat = false; | ||
+ | bool etat2 = false; | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(9600); | ||
+ | |||
+ | // Vérification de la présence du module WiFi | ||
+ | if (WiFi.status() == WL_NO_MODULE) { | ||
+ | Serial.println(" | ||
+ | // Arrêt | ||
+ | while (true) | ||
+ | ; | ||
+ | } | ||
+ | |||
+ | String fv = WiFi.firmwareVersion(); | ||
+ | if (fv < WIFI_FIRMWARE_LATEST_VERSION) { | ||
+ | Serial.println(" | ||
+ | } | ||
+ | |||
+ | // Tentative de connexionau réseau WiFi | ||
+ | while (status != WL_CONNECTED) { | ||
+ | Serial.print(" | ||
+ | Serial.println(ssid); | ||
+ | status = WiFi.begin(ssid, | ||
+ | |||
+ | // Attente de 10s pour la connexion | ||
+ | delay(10000); | ||
+ | } | ||
+ | |||
+ | Serial.println(" | ||
+ | affichageStutWiFi(); | ||
+ | Serial.println(" | ||
+ | |||
+ | // Démarre la liaison UDP | ||
+ | Udp.begin(localPort); | ||
+ | |||
+ | // Intialisation des ports de la station météo | ||
+ | pinMode(anemometre, | ||
+ | pinMode(13, OUTPUT); | ||
+ | |||
+ | temps = millis(); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | if ((digitalRead(anemometre) == HIGH) && (etat == false) && (etat2 == false)) { | ||
+ | etat = true; | ||
+ | etat2 = true; | ||
+ | int duree = millis() - temps; | ||
+ | float vitesse = 10.0 / duree; | ||
+ | float angle; | ||
+ | switch (analogRead(A1) / 100) { | ||
+ | case 0: | ||
+ | angle = 0.0; // | ||
+ | break; | ||
+ | case 1: | ||
+ | angle = PI_4; // | ||
+ | break; | ||
+ | case 2: | ||
+ | angle = PI_2; // | ||
+ | break; | ||
+ | case 4: | ||
+ | angle = PI7_4; // | ||
+ | break; | ||
+ | case 6: | ||
+ | angle = PI3_4; // | ||
+ | break; | ||
+ | case 7: | ||
+ | angle = PI3_2; // | ||
+ | break; | ||
+ | case 8: | ||
+ | angle = PI5_4; // | ||
+ | break; | ||
+ | case 9: | ||
+ | angle = PI; // | ||
+ | break; | ||
+ | } | ||
+ | envoyeDonnees(vitesse * cos(angle), vitesse * sin(angle), serveurIp, serveurPort); | ||
+ | temps = millis(); | ||
+ | } | ||
+ | if ((digitalRead(anemometre) == HIGH) && (etat == false) && (etat2 == true)) { | ||
+ | etat2 = false; | ||
+ | etat = true; | ||
+ | } | ||
+ | if (digitalRead(anemometre) == LOW) { | ||
+ | etat = false; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | void envoyeDonnees(float x, float y, IPAddress serveurIp, unsigned int ServeurPort) { | ||
+ | |||
+ | // Formaqtion du message OSC | ||
+ | uint8_t message[] = { 0x2F, 0x76, 0x65, 0x6E, 0x74, 0x00, 0x00, 0x00, 0x2C, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
+ | uint8_t xTab[4]; | ||
+ | uint8_t yTab[4]; | ||
+ | memcpy(& | ||
+ | memcpy(& | ||
+ | for (int j = 0; j < 4; j++) { | ||
+ | memcpy(& | ||
+ | memcpy(& | ||
+ | } | ||
+ | |||
+ | // Envoie du message par UDP | ||
+ | Udp.beginPacket(serveurIp, | ||
+ | Udp.write(message, | ||
+ | Udp.endPacket(); | ||
+ | } | ||
+ | |||
+ | void affichageStutWiFi() { | ||
+ | // Affiche le SSID du réseau | ||
+ | Serial.print(" | ||
+ | Serial.println(WiFi.SSID()); | ||
+ | |||
+ | // Affiche l' | ||
+ | IPAddress ip = WiFi.localIP(); | ||
+ | Serial.print(" | ||
+ | Serial.println(ip); | ||
+ | |||
+ | // Affiche la force du signal reçu | ||
+ | long rssi = WiFi.RSSI(); | ||
+ | Serial.print(" | ||
+ | Serial.print(rssi); | ||
+ | Serial.println(" | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Archive projet ==== | ||
+ | {{ :apps.zip |Archive}} | ||
+ | ==== Code teteDeTurc ==== | ||
+ | Code pour la prise de photos pour les festivaliers. | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== Code cielMonPrintemps ==== | ||
+ | Programme principal de l' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== Liens pour le code ==== | ||
[[https:// | [[https:// | ||
Ligne 15: | Ligne 211: | ||
[[https:// | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | bluetooth en Python]] | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | ===== Droidcam ===== | ||
+ | Application qui permet de transformer son téléphone en caméra sans fil vue comme une webcam | ||
+ | * https:// | ||
+ | * https:// | ||
+ | Lancer l' | ||
+ | FP3:/ # monkey -p com.dev47apps.droidcam -v 1 | ||
+ | FP3:/ # ps -A |grep cam | ||
+ | u0_a156 | ||
+ | FP3:/ # kill 31680 | ||
{{tag> sylvain, OpenFrameworks}} | {{tag> sylvain, OpenFrameworks}} | ||
+ | |||
+ | |||
cielmonprintemps.1709759867.txt.gz · Dernière modification : 2024/03/06 21:17 de Mushussu