diff --git a/Code Nico/main.py b/Code Nico/main.py index 56fd67fccdaf2820577e5da923f8d152c04a85f2..ae2458fd629856a4ad92c308cda46d6e6f5d5b86 100644 --- a/Code Nico/main.py +++ b/Code Nico/main.py @@ -84,7 +84,6 @@ def handle_receive(msg, d): print("Matsize : {} {}".format(x, y)) matsize = [int(x), int(y)] - # Main @@ -98,4 +97,4 @@ while True: if msg == b"": continue msg = msg_to_str(msg) - handle_receive(msg, d) \ No newline at end of file + handle_receive(msg, d) diff --git a/logbook_dawid.md b/logbook_dawid.md index 30903e0ea94f885458e28e02da06d70129d54f23..d39c4f35ac50097178f7cd28d1f857530da0b450 100644 --- a/logbook_dawid.md +++ b/logbook_dawid.md @@ -83,3 +83,116 @@ envoyer_msg(E,"Hello) ``` +Un decallage est possible réglant un temps d'attente sur les matrix précédente , celle de droite fait défilé le texte, une fois la fin de matrix atteinte dans un certain temps, la matrix à l'Ouest utilise la fonction Affiche_texte(message) ect ... jusqu'a la derniére matrix de la ligne . + +## Date Mardi 27 Juin 2023 +Nouvelle Tache attribué comme l'affichage est fait pas nico désormais , je suis passé sur la communication ESP32 et carte Mylab , par Uart , +Nous avons découvert que la carte mylab utilise un protocol étrange et personnelle pour la communication . elle réalise une checksum , et utilise un crc . +Tout D'abord Installation de l'IDE Arduino et du module ESP32 dedans ! +la datasheet de l'esp 32 que j'ai : +[lien datasheet](https://www.distrelec.ch/Web/Downloads/_m/an/3405_eng_man.pdf) + +j'ai suivi se guide pour y parvenir : +[lien ](https://support.arduino.cc/hc/en-us/articles/360019833020-Download-and-install-Arduino-IDE) +et ce lien [lien installation ](https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/) + +Ici un lien pour Projet MQTT public qui pourrai servir : +[lien pour le projet](https://randomnerdtutorials.com/esp32-mqtt-publish-subscribe-arduino-ide/) + + +Voici un code d'exemple pour la reception Uart sur les pin RX TX sur l'esp32 . +```C +#include <HardwareSerial.h> + +void setup() { + Serial.begin(115200); + Serial2.begin(115200, SERIAL_8N1, 16, 17); // RX pin: 16, TX pin: 17 +} + +void loop() { + if (Serial2.available()) { + char receivedData = static_cast<char>(Serial2.read()); + Serial.print("Received data as int: "); + Serial.println(static_cast<int>(receivedData)); + + Serial.print("Received data as string: "); + Serial.println(String(receivedData)); + + Serial.print("Received data as hex: 0x"); + if (receivedData < 0x10) { + Serial.print("0"); // Add leading zero for single-digit hexadecimal values + } + Serial.println(static_cast<int>(receivedData), HEX); + + Serial.println(); + } +} +``` + +Voici le resultat si on envoie Hello depuis l'hepialight : +``` +screen /dev/ttyACM0 // connection a la carte +ctrl +c pour activé la console python +envoyer_msg(E,'Hello.') +``` + +Reception ESP32 via l'interface Serial dans ide arduino +``` +Received data as int: 119 +Received data as string: w +Received data as hex: 0x77 + +Received data as int: 5 +Received data as string: +Received data as hex: 0x05 + +Received data as int: 72 +Received data as string: H +Received data as hex: 0x48 + +Received data as int: 101 +Received data as string: e +Received data as hex: 0x65 + +Received data as int: 108 +Received data as string: l +Received data as hex: 0x6C + +Received data as int: 108 +Received data as string: l +Received data as hex: 0x6C + +Received data as int: 111 +Received data as string: o +Received data as hex: 0x6F + +Received data as int: 71 +Received data as string: G +Received data as hex: 0x47 + +Received data as int: 170 +Received data as string: � +Received data as hex: 0xAA + +``` + +Aprés plusieurs Test Nous avons Determiné qu'il y a un protocol étrange sur l'hepialight avec un formatage de message unique +``` + 0x77 = w correspond au Start + + 0x05 Correspond à la longeur Len + + Hello Pour les Data envoyé + + 0x71 = G , Correspond à un Checksum avec du reverse engeenering et des tests de calcule divers on a remarqué que cela est calculer par un X0R de chaque caractère suivi d'un XOR par LEN + + 0xAA =170 Est pour terminé le message , pour un Stop . + + +Une autre Découvert que nous avons trouvé Si nous envoyons par exemple des données binaire qui serai 0xAA ou 0x// il faut rajouté 0x10 aprés sinon le message sera mal Compris par Hepialight . +``` +``` +Donc pour l'envoie de l'uart à l'Hepialight il faudra le faire par le même forma . + +``` +