{"id":1626,"date":"2021-11-14T17:28:38","date_gmt":"2021-11-14T22:28:38","guid":{"rendered":"http:\/\/ve2cuy.com\/420-1c4\/?page_id=1626"},"modified":"2024-03-18T09:41:28","modified_gmt":"2024-03-18T14:41:28","slug":"projet-epreuve-synthese","status":"publish","type":"page","link":"https:\/\/ve2cuy.com\/420-1c4\/index.php\/projet-epreuve-synthese\/","title":{"rendered":"Projet &#8211; \u00c9preuve Synth\u00e8se"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"320\" src=\"http:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/mars2020-epreuve-1840x575-1-1024x320.jpg\" alt=\"\" class=\"wp-image-1704\" srcset=\"https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/mars2020-epreuve-1840x575-1-1024x320.jpg 1024w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/mars2020-epreuve-1840x575-1-300x94.jpg 300w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/mars2020-epreuve-1840x575-1-768x240.jpg 768w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/mars2020-epreuve-1840x575-1-1536x480.jpg 1536w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/mars2020-epreuve-1840x575-1.jpg 1840w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#697279\">\u00c9nonc\u00e9 <span class=\"has-inline-color has-vivid-green-cyan-color\">2021.11.28.01<\/span> du projet de l&rsquo;\u00e9preuve synth\u00e8se<\/h2>\n\n\n\n<h2 class=\"has-text-align-center has-vivid-red-color has-text-color wp-block-heading\">Version finale de l&rsquo;\u00e9nonc\u00e9. <br><br><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">Pond\u00e9ration :<\/span> <span class=\"has-inline-color has-vivid-red-color\">50%<\/span><\/h2>\n\n\n\n<h2 class=\"has-text-align-left wp-block-heading\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">Date de remise:<\/span><span class=\"has-inline-color has-vivid-red-color\"> mardi le 14 d\u00e9cembre 2021<\/span><\/h2>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h4 class=\"has-text-align-left has-text-color has-medium-font-size wp-block-heading\" style=\"color:#246a51\">\u00c0 chaque semaine, ce document fournira des informations suppl\u00e9mentaires pour la r\u00e9alisation du projet de session.<\/h4>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-luminous-vivid-amber-color has-text-color wp-block-heading\">Contexte de r\u00e9alisation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u00c0 partir <\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>d&rsquo;un <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Arduino Uno<\/span><\/strong>,<\/li><li>d&rsquo;un <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Arduino Mega<\/span><\/strong> (<strong><span class=\"has-inline-color has-vivid-purple-color\">semaine 03 du projet<\/span><\/strong>)<\/li><li>d&rsquo;un module <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">NeoPixel<\/span><\/strong> connect\u00e9 sur D2,<\/li><li>d&rsquo;un module <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">rgb_lcd<\/span><\/strong><\/li><li>d&rsquo;un <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">potentiom\u00e8tre<\/span><\/strong> connect\u00e9 sur A3,<\/li><li>d&rsquo;un <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">bouton<\/span><\/strong> momentan\u00e9 connect\u00e9 sur D3<\/li><li>d&rsquo;un <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">avertisseur sonore<\/span><\/strong> (buzzer) connect\u00e9 sur D4<\/li><li>d&rsquo;un <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">d\u00e9tecteur de mouvements<\/span><\/strong> connect\u00e9 sur D5<\/li><li>d&rsquo;une <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">DEL<\/span><\/strong> (LED) connect\u00e9e sur D6<\/li><li>d&rsquo;une <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">sonde de temp\u00e9rature<\/span><\/strong><\/li><li>d&rsquo;un 4 digit display connect\u00e9 sur D7 (<a href=\"https:\/\/github.com\/ve2cuy\/ve2cuy-Grove_4Digital_Display_V2\">t\u00e9l\u00e9charger la librairie du prof<\/a>)<\/li><li>d&rsquo;un <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Arduino Mega<\/span> <\/strong>connect\u00e9 de <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">UART2<\/span><\/strong> vers D8 du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Arduino Uno<\/span><\/strong> (<strong><span class=\"has-inline-color has-vivid-purple-color\"><strong>semaine 03 du projet<\/strong><\/span><\/strong>)<\/li><li>d&rsquo;un module <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">RTC<\/span><\/strong> (Real Time Clock) <\/li><\/ul>\n\n\n\n<p class=\"has-text-align-left\"><strong>Programmer un syst\u00e8me d&rsquo;alarme en utilisant tous les connaissances acquises durant le cours.<\/strong>  <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/istockphoto-1151963866-612x612-1.jpg\" alt=\"\" class=\"wp-image-1632\" width=\"400\" height=\"400\" srcset=\"https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/istockphoto-1151963866-612x612-1.jpg 612w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/istockphoto-1151963866-612x612-1-300x300.jpg 300w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/istockphoto-1151963866-612x612-1-150x150.jpg 150w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#a41212\"><br>T\u00e2ches pour la semaine 01 du projet (15 novembre 2021)<\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"360\" src=\"http:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/360_F_288592326_LnsWb4ec3wlwjxKjXoa0ekrlqx9CquA1.jpg\" alt=\"\" class=\"wp-image-1702\" srcset=\"https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/360_F_288592326_LnsWb4ec3wlwjxKjXoa0ekrlqx9CquA1.jpg 600w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/360_F_288592326_LnsWb4ec3wlwjxKjXoa0ekrlqx9CquA1-300x180.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/figure><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>Connecter tous les modules du projet \u00e0 la plaquette <strong>Arduino Uno<\/strong>.<\/li><li>Cr\u00e9er le projet <strong><span style=\"color:#909598\" class=\"has-inline-color\">MATRICULE-SYN4201C4-2021<\/span><\/strong><\/li><li>Renseigner un commentaire d&rsquo;ent\u00eate avec les informations suivantes:<ul><li><strong>Nom du fichier:<\/strong><\/li><li><strong>Auteur:<\/strong><\/li><li><strong>Date:<\/strong><\/li><li><strong>Description:<\/strong><\/li><li><strong>Mise \u00e0 jour:<\/strong><\/li><\/ul><\/li><li>Documenter chaque section du projet:<ul><li>#include,<\/li><li>macros,<\/li><li>variables globales,<\/li><li>lignes de code,<\/li><li>fonctions, param\u00e8tres, valeur de retour.<\/li><\/ul><\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Initialiser les modules du projet. <ul><li>Au besoin, d\u00e9finir des Macros pour les num\u00e9ros des broches et pour les valeurs des constantes.<\/li><\/ul><\/li><li>Utiliser la compilation conditionnelle pour l&rsquo;affichage dans le moniteur s\u00e9rie: &lsquo;<strong>ifdef<\/strong>&lsquo;. <\/li><li>Utiliser des noms significatifs pour les variables.  <ul><li>Par exemple, <strong>accumulateurDuBouton<\/strong>, <strong>detectionDeMouvement<\/strong>, &#8230;<\/li><\/ul><\/li><li>Afficher<sup><span class=\"has-inline-color has-vivid-red-color\"><strong>(1)<\/strong><\/span><\/sup> dans le moniteur s\u00e9rie (<strong>\u00e0 115200 baud<\/strong>) la valeur des capteurs et des modules suivants:<ul><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">potentiom\u00e8tre<\/span><\/strong><\/li><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">accumulateur du bouton<\/span><\/strong><\/li><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">d\u00e9tecteur de mouvements<\/span><\/strong><\/li><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">sonde de temp\u00e9rature<\/span><\/strong><ul><li>temp\u00e9rature<\/li><li>humidit\u00e9<\/li><\/ul><\/li><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">RTC<\/span><\/strong><ul><li>nom du jour, nom du mois, hh:mm:ss<\/li><\/ul><\/li><li><strong><span class=\"has-inline-color has-luminous-vivid-orange-color\">Par exemple<\/span><\/strong>,<ul><li><strong>D\u00e9tecteur de mouvements<\/strong>: <span class=\"has-inline-color has-vivid-green-cyan-color\"><strong>OFF<\/strong><\/span><\/li><li><strong>Potentiom\u00e8tre<\/strong>: <span class=\"has-inline-color has-vivid-green-cyan-color\"><strong>314<\/strong><\/span><\/li><li><strong>Temp\u00e9rature<\/strong>: <span class=\"has-inline-color has-vivid-green-cyan-color\"><strong>22.5c<\/strong><\/span><\/li><li><strong>Accumulateur du bouton<\/strong>: <span class=\"has-inline-color has-vivid-green-cyan-color\"><strong>25<\/strong><\/span><\/li><li><strong>Temps:<\/strong> <span class=\"has-inline-color has-vivid-green-cyan-color\"><strong>2021.11.20 12:12:00<\/strong><\/span> <\/li><\/ul><\/li><\/ul><\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>Au d\u00e9marrage de l&rsquo;application, afficher sur le <strong>LCD<\/strong>, pendant <strong>10 secondes<\/strong><ul><li>Ligne 1: &lsquo;<strong>Alarme 420-1C4<\/strong>&lsquo;, Ligne 2: &lsquo;<strong>Dormez en paix<\/strong>&lsquo;<\/li><\/ul><\/li><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Afficher<\/span><\/strong>, (en utilisant le d\u00e9filement sur une seule ligne) le message suivant:<ol><li>&lsquo;<strong>Syst\u00e8me d&rsquo;alarme 420-1C4. Nous sommes <span class=\"has-inline-color has-vivid-red-color\">lundi<\/span> le <span class=\"has-inline-color has-vivid-red-color\">99 novembre 2021<\/span> et il est <span class=\"has-inline-color has-vivid-red-color\">hh:mm:ss<\/span>.  Pour la configuration du systeme, appuyer sur le bouton de panique&#8230;<\/strong>&lsquo;<\/li><li>Apr\u00e8s 30 secondes d&rsquo;inactivit\u00e9 (pas d&rsquo;action sur le bouton)<ul><li>\u00c9teindre le <strong>rgb_lcd<\/strong> (seulement les DELs RGB du fond d&rsquo;\u00e9cran)<\/li><li>Indice: <strong>millis() &#8211; millis_d\u00e9part &gt; 30 000<\/strong>.<\/li><\/ul><\/li><li>(<strong><span class=\"has-inline-color has-vivid-purple-color\">3<\/span><\/strong>) Si le <strong>bouton<\/strong> est appuy\u00e9 dans les <strong>30 secondes<\/strong>, allumer la <strong>DEL<\/strong> et <ul><li>afficher sur la ligne 1 &lsquo;<strong>Entrer le code:<\/strong>&lsquo;<\/li><li>afficher sur la ligne 2: <strong>&lsquo; 1 2 3 4<\/strong> *<strong>OK<\/strong>&lsquo;<\/li><li>Si <strong>bouton<\/strong> appuy\u00e9 <strong>avant<\/strong> 30 secondes alors <ul><li>afficher &lsquo;<strong><span class=\"has-inline-color has-vivid-red-color\">On<\/span><\/strong>&lsquo; sur le <strong>4-Digi<\/strong>t sinon, afficher &lsquo;<strong><span class=\"has-inline-color has-vivid-red-color\">OFF<\/span><\/strong>&lsquo;<\/li><li>faire <strong>clignoter<\/strong> les pixels du <strong>neopixel<\/strong> du rouge au bleu 3 fois dans 2 secondes <\/li><\/ul><\/li><\/ul><ul><li>Apr\u00e8s 30 secondes d&rsquo;inactivit\u00e9 (pas d&rsquo;action sur le <strong>bouton<\/strong>)<ul><li>\u00c9teindre le <strong>rgb_lcd<\/strong><\/li><li>Apr\u00e8s, \u00e0 l&rsquo;utilisation du <strong>bouton<\/strong>, retourner \u00e0 l&rsquo;\u00e9tape <strong><span class=\"has-inline-color has-vivid-purple-color\">3<\/span><\/strong><\/li><\/ul><\/li><\/ul><\/li><\/ol><\/li><\/ul>\n\n\n\n<p class=\"has-text-align-left\"><span><span class=\"has-inline-color has-vivid-red-color\"><sup><strong>(1)<\/strong><\/sup><\/span><\/span><span class=\"has-inline-color has-vivid-red-color\"><b>NOTE<\/b><\/span>: Pour ne pas causer de d\u00e9bordements de la console s\u00e9rie ou injecter des d\u00e9lais inutiles dans l&rsquo;application,  il est sugg\u00e9r\u00e9 d&rsquo;utiliser la technique du <a href=\"http:\/\/ve2cuy.com\/420-1c4\/index.php\/solutionnaire-examen-2021\/\">solutionnaire<\/a> de l&rsquo;examen pour l&rsquo;affichage de traces dans la console s\u00e9rie, c-a-d, l&rsquo;utilisation d&rsquo;un minuteur (<strong>timer<\/strong>) et d&rsquo;une fonction associ\u00e9e \u00e0 son interruption.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Remise de l&rsquo;\u00e9tape 01<\/h2>\n\n\n\n<p><strong>Il faut remettre cette \u00e9tape du projet, sur LEA avant le dimanche, 21 novembre 23h55<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-luminous-vivid-orange-color has-text-color wp-block-heading\">Astuces de la semaine 01<\/h2>\n\n\n\n<h3 class=\"has-vivid-cyan-blue-color has-text-color wp-block-heading\">1.1 &#8211; Exemple de d\u00e9filement d&rsquo;un long message sur la ligne 2 du LCD<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/*\n    Fichier:  exemple.defilement.lcd.ino\n    Auteur:   Alain Boudreault\n    Date:     2021.11.21\n    -------------------------------------------------------------\n    Description:  D\u00e9filer un tr\u00e8s long texte sur la ligne no 2\n                  de l'\u00e9cran LCD.\n    -------------------------------------------------------------\n    M-A-J:\n    -------------------------------------------------------------                      \n*\/\n\n#include \"rgb_lcd.h\"\n#define LCD_LONGUEUR_LIGNE          16\n#define LCD_NOMBRE_LIGNE            2\n#define LCD_LIGNE_DE_DEFILEMENT     1\n#define LCD_DEBUT_LIGNE             0\n#define DELAI_DEFILEMENT            250\n#define UN_CAR_ESPACE               \" \"\n#define SEIZE_ESPACES               \"                \"\n#define UNE_CITATION_DE_HUGO        \"Il fit de la sorte un assez long chemin ...\"\n#define LONGUEUR_LONGUE_CHAINE      100\n\nchar unLongMessage[LONGUEUR_LONGUE_CHAINE]; \nrgb_lcd lcd;\n\n\/\/ **********************\nvoid setup()\n\/\/ **********************\n{\n  char unTitre[] = \"420-1C4\";\n  lcd.begin (LCD_LONGUEUR_LIGNE, LCD_NOMBRE_LIGNE);\n  lcd.setCursor((LCD_LONGUEUR_LIGNE \/ 2 - strlen(unTitre) \/ 2) - 1, 0 \/* ligne no 1 *\/);  \/\/ Centrer le titre\n  lcd.print(unTitre); \/\/ Afficher un titre sur la premi\u00e8re ligne du LCD\n} \/\/ setup\n\n\/\/ **********************\nvoid loop()\n\/\/ **********************\n{\n  static unsigned long int iteration = 0;\n  \/\/ Construire la chaine \u00e0 d\u00e9filer sur l'\u00e9cran LCD\n  \/\/ Le message \u00e0 afficher d\u00e9bute et se termine avec 16 caract\u00e8res ' '\n  \/\/ Cela \u00e9vite une gestion lourde du curseur  \n  sprintf(unLongMessage, \"%s%s - Iteration: %lu%s\", SEIZE_ESPACES, UNE_CITATION_DE_HUGO, ++iteration, SEIZE_ESPACES);\n\n  \/\/ Afficher le message \u00e0 partir de toutes les positions des caract\u00e8res du message - longueur du LCD\n  for (int positionDansLeMessage = 0; positionDansLeMessage &lt;= strlen(unLongMessage) - LCD_LONGUEUR_LIGNE; positionDansLeMessage++) \n  {\n   afficherCaracteres(positionDansLeMessage, unLongMessage);\n  } \/\/ for\n} \/\/ loop\n\n\/*\n  =====================================================================\n  Afficher LCD_LONGUEUR_LIGNE - 1 caract\u00e8res d'une chaine de caract\u00e8res\n     re\u00e7ue dans  'uneChaineDeCaracteres', \n  \u00e0 partir d'une position dans la chaine \n     re\u00e7ue par   'positionAImprimmer',\n  d\u00e9caler le tout vers la gauche en affichant un espace \" \",\n  puis attendre un peu (DELAI_DEFILEMENT).\n  =====================================================================\n*\/\nvoid afficherCaracteres(int positionAImprimmer, char uneChaineDeCaracteres[])\n{\n  lcd.setCursor(LCD_DEBUT_LIGNE, LCD_LIGNE_DE_DEFILEMENT);\n  \/\/ Afficher seulement 16 caract\u00e8res de la chaine de caract\u00e8res\n  for (int  positionCaractereAImprimer = positionAImprimmer; \n            positionCaractereAImprimer &lt;= positionAImprimmer + (LCD_LONGUEUR_LIGNE - 1);\n            positionCaractereAImprimer++)\n  {\n    lcd.print(uneChaineDeCaracteres[positionCaractereAImprimer]);\n  }\n  lcd.print(UN_CAR_ESPACE);     \/\/ puis, d\u00e9caler le tout vers la gauche ...\n  delay(DELAI_DEFILEMENT);      \/\/ Attendre un peu, dans le but de ralentir le d\u00e9filement ...\n} \/\/ afficherCaracteres\n\n\/\/ **** FIN DU FICHIER ****<\/pre>\n\n\n\n<h3 class=\"has-vivid-cyan-blue-color has-text-color wp-block-heading\">1.2 &#8211; Utilisation de millis() pour un d\u00e9lai non bloquant<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/*\n    Fichier:  5secondes.ino\n    Auteur:   Alain Boudreault\n    Date:     2021.11.21\n    -----------------------------------------------------\n    Description:  Exemple d'un d\u00e9lai non bloquant avec\n                  l'utilisation de la fonction millis()\n    -----------------------------------------------------\n    M-A-J:\n    -----------------------------------------------------\n*\/\n\n#define UN_DELAI        5000\n#define MESSAGE_DELAI   \"5 secondes sont passees...\"\n\n\/\/ **************************\nvoid setup() {\n  Serial.begin(9600);\n  Serial.println(\"Debut du programme\\n\");\n} \/\/ setup\n\n\/\/ **************************\nvoid loop() {\n  if (delaiAtteint())\n    Serial.println(MESSAGE_DELAI);\n} \/\/ loop\n\n\/\/ **************************\nbool delaiAtteint()\n{\n  static unsigned long int tempsDepart = millis();\n\n  if (millis() - tempsDepart > UN_DELAI) {\n    \/\/ Nous avons atteint le delai\n    \/\/ Replacer tempsDepart au moment courant\n    tempsDepart = millis();\n    return true;\n  } else return false;\n} \/\/ delaiAtteint()\n\n\/\/ ***** FIN DU FICHIER *****<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"has-vivid-cyan-blue-color has-text-color wp-block-heading\">1.3 &#8211; \u00c9teindre l&rsquo;\u00e9cran LCD apr\u00e8s une p\u00e9riode d&rsquo;inactivit\u00e9<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/*\n    Fichier:  eteindreLCD.apres.delai.inactiviteBouton.ino\n    Auteur:   Alain Boudreault\n    Date:     2021.11.21\n    -----------------------------------------------------\n    Description:  \u00c9teindre l'\u00e9cran LCD s'il n'y a pas\n                  d'utilisation du bouton pendant la\n                  p\u00e9riode de delai definie par UN_DELAI.\n    -----------------------------------------------------\n    M-A-J:\n    -----------------------------------------------------\n*\/\n\n#include \"rgb_lcd.h\"\n\n#define UN_DELAI        5000\n#define MESSAGE         \"Le bouton n'a pas \u00e9t\u00e9 appuy\u00e9 dans la p\u00e9riode de delai.\"\n#define BOUTON          3\n#define MSG_LCD         \"Appuyer le btn\"\n#define LCD_OFF         0,0,0\n#define LCD_ON          255,255,255\n\nrgb_lcd lcd;\nunsigned long int departDelaiBouton;\n\n\/\/ **************************\nvoid setup() {\n  Serial.begin(9600);\n  Serial.println(\"Debut du programme\\n\");\n  pinMode(BOUTON, INPUT);\n  lcd.begin(16, 2);\n  lcd.print(MSG_LCD);\n  departDelaiBouton = millis();\n} \/\/ setup\n\n\/\/ **************************\nvoid loop() {\n  static bool boutonAppuye = false;\n\n  \/\/ Lire l'\u00e9tat du bouton\n  if (digitalRead(BOUTON)) {  \/\/ Le bouton est enfonc\u00e9\n     boutonAppuye = true;\n     \/\/ Attendre que le bouton soit relach\u00e9 avec de continuer\n     while (digitalRead(BOUTON));\n  } \/\/ if digitalRead(BOUTON)\n\n  \/\/ \u00c9teindre le LCD si le bouton est inactif pendant la p\u00e9riode de d\u00e9lai\n  if (delaiAtteint() &amp;&amp; !boutonAppuye) {\n    \/\/ Le bouton n'a pas \u00e9t\u00e9 appuy\u00e9 dans la p\u00e9riode de delai\n    Serial.println(MESSAGE);\n    \/\/ \u00c9teindre le LCD\n    lcd.setRGB(LCD_OFF);\n  } \/\/ delaiAtteint() &amp;&amp; !boutonAppuye\n\n  \/\/ Allumer le LCD, peut importe son \u00e9tat, si le bouton a \u00e9t\u00e9 appuy\u00e9 \n  if (boutonAppuye) {\n      Serial.println(\"Bouton appuy\u00e9, le delai pour \u00e9teindre le LCD \u00e0 \u00e9t\u00e9 r\u00e9initialis\u00e9.\");\n      lcd.setRGB(LCD_ON);\n      boutonAppuye = false;\n      \/\/ R\u00e9initialiser le temps de d\u00e9part du delai d'utilisation du bouton\n      departDelaiBouton = millis();\n  } \/\/ if boutonAppuye\n\n} \/\/ loop\n\n\/\/ **************************\nbool delaiAtteint()\n{\n  if (millis() - departDelaiBouton > UN_DELAI) {\n    \/\/ Nous avons atteint le delai\n    \/\/ Replacer tempsDepart au moment courant\n    departDelaiBouton = millis();\n    return true;\n  } else return false;\n} \/\/ delaiAtteint()\n\n\/\/ ***** FIN DU FICHIER *****<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-vivid-red-color has-text-color wp-block-heading\">1.4 &#8211; Version minimale de l&rsquo;\u00e9tape 01 (- 7%)<\/h2>\n\n\n\n<p>Pour une<strong><span class=\"has-inline-color has-vivid-red-color\"> p\u00e9nalit\u00e9 de 7%<\/span><\/strong> (correction \u00e0 partir de <strong><span class=\"has-inline-color has-vivid-red-color\">93\/100<\/span><\/strong>) il est possible de r\u00e9aliser cette version minimale de l&rsquo;\u00e9tape 01:<\/p>\n\n\n\n<p><strong>Au d\u00e9marrage de l&rsquo;application,<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Afficher<\/span><\/strong> sur le <strong>LCD<\/strong>:<ol><li><span style=\"font-size: Revert; color: initial;\">Ligne 1: &lsquo;<\/span><strong style=\"color: initial;\">Alarme 420-1C4<\/strong><span style=\"font-size: Revert; color: initial;\">&lsquo;, <\/span><\/li><li><span style=\"font-size: Revert; color: initial;\">Ligne 2: &lsquo;<\/span><strong style=\"color: initial;\">Dormez en paix<\/strong><span style=\"font-size: Revert; color: initial;\">&lsquo;<\/span><\/li><\/ol><\/li><li><span class=\"has-inline-color has-vivid-cyan-blue-color\"><strong>Attendre<\/strong><\/span> 10 secondes puis<\/li><li><strong style=\"color: initial;\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">Afficher<\/span><\/strong><span style=\"color: initial; font-size: Revert;\">, (en utilisant le d\u00e9filement sur une seule ligne) le message suivant:<\/span><ol><li><span style=\"font-size: Revert; color: initial;\">&lsquo;<\/span><strong style=\"color: initial;\">Systeme d&rsquo;alarme 420-1C4. Nous sommes <span class=\"has-inline-color has-vivid-red-color\">lundi<\/span> le <span class=\"has-inline-color has-vivid-red-color\">99 novembre 2021<\/span> et il est <span class=\"has-inline-color has-vivid-red-color\">hh:mm:ss<\/span>.  Pour la configuration du systeme, appuyer sur le bouton de panique&#8230;<\/strong><span style=\"font-size: Revert; color: initial;\">&lsquo;<\/span><\/li><\/ol><\/li><li><span style=\"font-size: Revert; color: initial;\">Si le <\/span><strong style=\"color: initial;\">bouton<\/strong><span style=\"font-size: Revert; color: initial;\"> est appuy\u00e9, <\/span><ol><li><span style=\"font-size: Revert; color: initial;\"><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Allumer<\/span><\/strong> la <\/span><strong style=\"color: initial;\">DEL<\/strong><span style=\"font-size: Revert; color: initial;\"> <\/span><\/li><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">A<\/span><span style=\"font-size: Revert; color: initial;\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">fficher<\/span><\/span><\/strong><ol><li><span style=\"font-size: Revert; color: initial;\">sur la ligne 1:  <\/span><strong style=\"color: initial;\">&lsquo;Entrer le code:&rsquo;<\/strong><\/li><li><span style=\"font-size: Revert; color: initial;\">sur la ligne 2:  <\/span><strong style=\"color: initial;\">&lsquo; 1 2 3 4<\/strong><span style=\"font-size: Revert; color: initial;\"> *<\/span><strong style=\"color: initial;\">OK<\/strong>&lsquo;<\/li><\/ol><\/li><\/ol><\/li><\/ol>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-vivid-purple-color has-text-color wp-block-heading\"><br>T\u00e2ches pour la semaine 02 du projet (22 novembre)<\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/cadenas-1024x743.png\" alt=\"\" class=\"wp-image-1750\" width=\"500\" height=\"600\"\/><\/figure><\/div>\n\n\n\n<ol class=\"has-medium-font-size wp-block-list\"><li><span class=\"has-inline-color has-luminous-vivid-amber-color\"><strong>Verrouiller\/D\u00e9verrouiller le syst\u00e8me d&rsquo;alarme.<\/strong><\/span><\/li><li><strong><span class=\"has-inline-color has-vivid-green-cyan-color\">G\u00e9rer le d\u00e9tecteur de mouvement et une temp\u00e9rature trop \u00e9lev\u00e9e.<\/span><\/strong><\/li><li><strong><span class=\"has-inline-color has-vivid-purple-color\">Envoyer des codes d&rsquo;\u00e9v\u00e9nement sur le petit vibreur (buzzer).<\/span><\/strong><\/li><\/ol>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Au <strong>d\u00e9marrage<\/strong> de l&rsquo;application, <strong><span class=\"has-inline-color has-vivid-red-color\">le syst\u00e8me d&rsquo;alarme est d\u00e9verrouill\u00e9<\/span><\/strong> (hors fonction).  C-A-D, qu&rsquo;il ne traite pas les deux \u00e9v\u00e9nements suivants:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>D\u00e9tecteur de mouvement activ\u00e9: <strong><em>if (digitalRead(DETECTEUR_MOUVEMENT))<\/em><\/strong><\/li><li>Temp\u00e9rature actuelle sup\u00e9rieure \u00e0 &lsquo;<strong><em>cons<\/em>t char temperatureMaximum = UNE_TEMPERATURE_MAXIMUM<\/strong>&lsquo;<\/li><\/ul>\n\n\n\n<p><span><span class=\"has-inline-color has-vivid-red-color\">1.1 &#8211; <\/span><\/span><span class=\"has-inline-color has-vivid-red-color\"><b>Pour activer le syst\u00e8me d&rsquo;alarme<\/b><\/span>, il faut renseigner le code de d\u00e9verrouillage \u00e0 partir:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>De l&rsquo;affichage <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">LCD<\/span><\/strong> suivant: <ul><li>&lsquo;<strong>Entrez le code<\/strong>&lsquo;<\/li><li><span style=\"font-size: Revert; color: initial;\"> <\/span><strong style=\"color: initial;\">&lsquo; 1  2  3  4<\/strong><span style=\"font-size: Revert; color: initial;\"> *<\/span><strong style=\"color: initial;\">OK<\/strong>&lsquo;<\/li><\/ul><\/li><li>Du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">bouton<\/span><\/strong><\/li><li>Du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">potentiom\u00e8tre<\/span><\/strong><\/li><\/ul>\n\n\n\n<p>\u00c0 chaque utilisation du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">bouton<\/span><\/strong>, le caract\u00e8re &lsquo;*&rsquo; change de position pour indiquer l&rsquo;action courante.<\/p>\n\n\n\n<p>Par exemple, \u00e0 la premi\u00e8re utilisation du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">bouton<\/span><\/strong>, la ligne 2 du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">LCD<\/span><\/strong> va afficher ceci:<\/p>\n\n\n\n<p><li><span style=\"font-size: Revert; color: initial;\"> <\/span><strong style=\"color: initial;\">&lsquo;*1  2  3  4<\/strong><span style=\"font-size: Revert; color: initial;\"> <\/span><span style=\"font-size: Revert; color: initial;\"> <\/span><strong style=\"color: initial;\">OK<\/strong>&lsquo;<\/li><\/p>\n\n\n\n<p>\u00c0 la prochaine utilisation du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">bouton<\/span><\/strong>,   la ligne 2 du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">LCD<\/span><\/strong> va afficher ceci:<\/p>\n\n\n\n<p><li><span style=\"font-size: Revert; color: initial;\"> <\/span><strong style=\"color: initial;\">&lsquo; 1 *2 3 4<\/strong><span style=\"font-size: Revert; color: initial;\"> <\/span><strong style=\"color: initial;\">OK<\/strong>&lsquo;<\/li><\/p>\n\n\n\n<p>L&rsquo;utilisation du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">potentiom\u00e8tre<\/span><\/strong> permet de faire varier la valeur du nombre suivant le caract\u00e8re &lsquo;*&rsquo; entre <strong><span class=\"has-inline-color has-vivid-red-color\">0 et 9<\/span><\/strong>.<\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">1.2 &#8211; Validation du code du syst\u00e8me d&rsquo;alarme<\/span><\/strong><\/p>\n\n\n\n<p>Lorsque le caract\u00e8re &lsquo;*&rsquo; est d\u00e9plac\u00e9 devant &lsquo;OK&rsquo;, le code du syst\u00e8me d&rsquo;alarme <strong><span class=\"has-inline-color has-vivid-red-color\">est valid\u00e9<\/span><\/strong>.<\/p>\n\n\n\n<p>Le <strong>code du syst\u00e8me d&rsquo;alarme<\/strong> est d\u00e9fini par la constante &lsquo;<strong>const unsigned int codeSystemeAlarme = 4203&prime;<\/strong><\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">Si le code entr\u00e9<\/span><\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>est <strong><span class=\"has-inline-color has-vivid-red-color\">invalide<\/span><\/strong>, faire vibrer le &lsquo;<strong style=\"color: initial;\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><span class=\"has-inline-color has-vivid-purple-color\">&lsquo;<\/span><\/strong> <span class=\"has-inline-color has-vivid-red-color\">deux (2) fois en 1 seconde<\/span><\/li><li>est <strong><span class=\"has-inline-color has-vivid-red-color\">valide<\/span><\/strong>, faire vibrer le &lsquo;<strong style=\"color: initial;\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><span class=\"has-inline-color has-vivid-purple-color\">&lsquo;<\/span><\/strong> <span class=\"has-inline-color has-vivid-red-color\">une (1) fois pendant 1\/2 seconde<\/span>, faire passer le syst\u00e8me d&rsquo;alarme en <strong><span class=\"has-inline-color has-vivid-red-color\">mode verrouill\u00e9<\/span><\/strong> (actif), <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">afficher<\/span><\/strong> &lsquo;<strong><span class=\"has-inline-color has-vivid-red-color\">On<\/span><\/strong>&lsquo; sur le <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">4-Digit<\/span><\/strong>.<\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"has-vivid-green-cyan-color has-text-color wp-block-heading\">2 &#8211; <strong style=\"color: initial;\"><span class=\"has-inline-color has-vivid-green-cyan-color\">Gestion du d\u00e9tecteur de mouvement et de la temp\u00e9rature<\/span><\/strong><\/h3>\n\n\n\n<p>Les fonctions suivantes sont ex\u00e9cut\u00e9es que <strong><span class=\"has-inline-color has-vivid-red-color\">SI LE SYST\u00c8ME D&rsquo;ALARME EST EN MODE VERROUILL\u00c9<\/span><\/strong> (ACTIF)<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\"><strong>2.1 &#8211; Afficher ce qui suit sur l&rsquo;\u00e9cran LCD<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Tmp: 99c Mov:OFF\n        hh:mm:ss<\/pre>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\"><strong>2.2 &#8211; Si le d\u00e9tecteur de mouvement devient actif<\/strong><\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Faire vibrer<\/span><\/strong> le &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><\/strong>&lsquo; cinq (5) fois en deux (2) secondes.  <strong><span class=\"has-inline-color has-vivid-red-color\">Attention<\/span><\/strong>, ne pas <strong><span class=\"has-inline-color has-vivid-purple-color\">refaire<\/span><\/strong> vibrer le &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><\/strong>&lsquo; tant que son \u00e9tat demeure sur &lsquo;<strong><span class=\"has-inline-color has-vivid-red-color\">ON<\/span><\/strong>&lsquo;.<\/p>\n\n\n\n<p>Tant que l&rsquo;\u00e9tat du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">d\u00e9tecteur de mouvement<\/span><\/strong> est \u00e0 &lsquo;<span class=\"has-inline-color has-vivid-red-color\">ON<\/span>&lsquo;<\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Afficher<\/span><\/strong> ce qui suit sur l&rsquo;\u00e9cran <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">LCD<\/span><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Tmp: 99c  Mov:ON\n        hh:mm:ss<\/pre>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">Note<\/span><\/strong>: Il faut r\u00e9actualiser la valeur hh:mm:ss au moins \u00e0 chaque seconde.<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\"><strong>Facultatif, 3 points extras<\/strong>, <span class=\"has-inline-color has-black-color\">faire clignoter (deux fois par seconde) &lsquo;<\/span><span class=\"has-inline-color has-vivid-red-color\">ON<\/span><span class=\"has-inline-color has-black-color\">&lsquo; sur le <\/span><span class=\"has-inline-color has-vivid-cyan-blue-color\"><strong>LCD<\/strong><\/span><span class=\"has-inline-color has-black-color\"> tant que l&rsquo;\u00e9tat du d\u00e9tecteur de mouvement est \u00e0 &lsquo;<\/span><span class=\"has-inline-color has-vivid-red-color\">ON<\/span><span class=\"has-inline-color has-black-color\">&lsquo; <\/span><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">2.3 &#8211; Si la temp\u00e9rature d\u00e9passe <\/span>&lsquo;<strong style=\"color: initial;\"><em>cons<\/em>t char temperatureMaximum<\/strong>&lsquo;<\/strong><\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Faire vibrer<\/span><\/strong> le &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><\/strong>&lsquo; deux (2) fois en une (1) seconde.  <\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">Attention<\/span><\/strong>, ne pas refaire vibrer le &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><\/strong>&lsquo; plus qu&rsquo;une fois par minute.  <strong><span class=\"has-inline-color has-vivid-red-color\">Note<\/span><\/strong>: Cette fonctionnalit\u00e9 vaut <span class=\"has-inline-color has-vivid-red-color\"><strong>5\/100<\/strong><\/span>.<\/p>\n\n\n\n<p>Tant que la temp\u00e9rature d\u00e9passe la &lsquo;<strong><strong style=\"color: initial;\">temperatureMaximum<\/strong><\/strong>&lsquo;<\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Afficher<\/span><\/strong> ce qui suit sur l&rsquo;\u00e9cran <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">LCD<\/span><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Tmp:*99c* Mov:ON\n        hh:mm:ss<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-vivid-red-color has-text-color wp-block-heading\">Version minimale de l&rsquo;\u00e9tape 02 (- 5%)<\/h2>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">NOTE<\/span><\/strong>: Dans cette version de l&rsquo;\u00e9tape 2, il n&rsquo;y a pas de menu de navigation pour renseigner le code du syst\u00e8me d&rsquo;alarme.  Le code de validation est compris entre 0 et 9<\/p>\n\n\n\n<p><span><span class=\"has-inline-color has-vivid-red-color\">1.1 &#8211; <\/span><\/span><span class=\"has-inline-color has-vivid-red-color\"><b>Pour activer le syst\u00e8me d&rsquo;alarme<\/b><\/span>, il faut renseigner le code de d\u00e9verrouillage \u00e0 partir:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>De l&rsquo;affichage <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">LCD<\/span><\/strong> suivant: <ul><li>&lsquo;<strong>Entrez le code<\/strong>&lsquo;<\/li><li><span style=\"font-size: Revert; color: initial;\"> <\/span><strong style=\"color: initial;\">&lsquo;0<\/strong>&lsquo;<\/li><\/ul><\/li><li>Du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">bouton<\/span><\/strong><\/li><li>Du <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">potentiom\u00e8tre<\/span><\/strong><\/li><\/ul>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\"><strong>1.2 &#8211; Validation du code du syst\u00e8me d&rsquo;alarme<\/strong><\/p>\n\n\n\n<p>Le <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">potentiom\u00e8tre<\/span><\/strong> permet de faire varier la valeur du code entre <strong><span class=\"has-inline-color has-vivid-red-color\">0<\/span><\/strong> et <strong><span class=\"has-inline-color has-vivid-red-color\">9<\/span><\/strong>.<\/p>\n\n\n\n<p>Le <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">bouton<\/span><\/strong> permet de valider que le code entr\u00e9 est \u00e9gal \u00e0 &lsquo;<strong><span class=\"has-inline-color has-vivid-red-color\">7<\/span><\/strong>&lsquo;<\/p>\n\n\n\n<p>Le <strong>code du syst\u00e8me d&rsquo;alarme<\/strong> est d\u00e9fini par la constante &lsquo;<strong>const unsigned int codeSystemeAlarme = 7&prime;<\/strong><\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">Si le code entr\u00e9<\/span><\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>est <strong><span class=\"has-inline-color has-vivid-red-color\">invalide<\/span><\/strong>, faire vibrer le &lsquo;<strong style=\"color: initial;\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><span class=\"has-inline-color has-vivid-purple-color\">&lsquo;<\/span><\/strong> <span class=\"has-inline-color has-vivid-red-color\">deux (2) fois en 1 seconde<\/span><\/li><li>est <strong><span class=\"has-inline-color has-vivid-red-color\">valide<\/span><\/strong>, faire vibrer le &lsquo;<strong style=\"color: initial;\"><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><span class=\"has-inline-color has-vivid-purple-color\">&lsquo;<\/span><\/strong> <span class=\"has-inline-color has-vivid-red-color\">une (1) fois pendant 1\/2 seconde<\/span>, faire passer le syst\u00e8me d&rsquo;alarme en <strong><span class=\"has-inline-color has-vivid-red-color\">mode verrouill\u00e9<\/span><\/strong> (actif).<\/li><\/ul>\n\n\n\n<p>Pour la suite, pass\u00e9 \u00e0:  <strong><span class=\"has-inline-color has-vivid-green-cyan-color\">2 &#8211; <\/span><\/strong><strong style=\"color: initial;\"><span class=\"has-inline-color has-vivid-green-cyan-color\">Gestion du d\u00e9tecteur de mouvement et de la temp\u00e9rature<\/span><\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-vivid-red-color has-text-color wp-block-heading\">Exemple d&rsquo;une solution pour la version minimale<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"cordpro\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ Exemple d'une solution pour la version minimale. ;-)\n#define CODE_SYSTEME_ALARME 7\nbool systemeArme = false;\n\nif (!systemeArme) {\n    Serial &lt;&lt; \"!systemeArme\\n\";\n    int PotMap = map(analogRead(POT), 0, 1023, 9, 0);\n    ecran.setCursor(0, 0);\n    ecran.print(\"Entrez le code: \");\n    ecran.setCursor(0, 1);\n    ecran.print(PotMap);\n    ecran.print(\" *OK\");\n    if (digitalRead(BOUTON)) {\n        while (digitalRead(BOUTON)); \/\/ Attendre que le bouton soit relach\u00e9 avant de continuer\n        if(PotMap == CODE_SYSTEME_ALARME){\n            systemeArme = true;\n        ecran.clear();\n        ecran.print(\"etape 03\");\n\n    } else { \/\/ Mauvais code\n\n        digitalWrite(BROCHE_DU_BUZZER, HIGH);\n        delay(500);\n        digitalWrite(BROCHE_DU_BUZZER, 0);\n}\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Remise de l&rsquo;\u00e9tape 02<\/h2>\n\n\n\n<p><strong>Il faut remettre cette \u00e9tape du projet, sur LEA avant le vendredi, 3 d\u00e9cembre<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-vivid-cyan-blue-color has-text-color wp-block-heading\"><br>T\u00e2ches pour la semaine 03 du projet (29 novembre)<\/h2>\n\n\n\n<h3 class=\"has-vivid-red-color has-text-color wp-block-heading\">Objectif de cette \u00e9tape &#8211; Mesurer votre degr\u00e9 d&rsquo;adaptation et d&rsquo;intiative.<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"842\" height=\"440\" src=\"http:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/networking-infographic.png\" alt=\"\" class=\"wp-image-1782\" srcset=\"https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/networking-infographic.png 842w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/networking-infographic-300x157.png 300w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/networking-infographic-768x401.png 768w\" sizes=\"auto, (max-width: 842px) 100vw, 842px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"has-vivid-purple-color has-text-color wp-block-heading\">3 &#8211; Relier le syst\u00e8me d&rsquo;alarme \u00e0 une centrale de surveillance.<\/h3>\n\n\n\n<p>R\u00e8gle g\u00e9n\u00e9rale, les syst\u00e8mes d&rsquo;alarme sont reli\u00e9s, en utilisant les c\u00e2bles du syst\u00e8me t\u00e9l\u00e9phonique, par r\u00e9seau cellulaire ou par le r\u00e9seau Internet, \u00e0 une centrale de surveillance \u00e0 distance.<\/p>\n\n\n\n<p>Si un \u00e9v\u00e8nement n\u00e9cessitant une intervention des services d&rsquo;urgence survient, la centrale de surveillance recevera un code d&rsquo;intervention et pourra agir en cons\u00e9quence.<\/p>\n\n\n\n<p>Nous simulerons ici ce type de topologie en utilisant le syst\u00e8me d&rsquo;alarme (UNO) reli\u00e9 \u00e0 la centrale (MEGA) par le port UART de ces derniers.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h3 class=\"has-vivid-red-color has-text-color wp-block-heading\">3.1 &#8211; Pour r\u00e9aliser cette \u00e9tape, il faut:<\/h3>\n\n\n\n<ul class=\"has-vivid-red-color has-text-color wp-block-list\"><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">D\u00e9placer<\/span><\/strong> le &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><\/strong>&lsquo; du &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Arduino Uno<\/span><\/strong>&lsquo; vers le port <strong><span class=\"has-inline-color has-vivid-red-color\">D4<\/span><\/strong> du &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Arduino Mega<\/span><\/strong>&lsquo;<\/li><li><strong>D\u00e9connecter le 4-Digit du Uno<\/strong> et invalider le code du 4-Digit avec un #ifndef ETAPE3.  Attention, cette \u00e9tape est importante sinon la connexion avec le Mega ne fonctionnera pas bien.<\/li><li><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Relier<\/span><\/strong> le port <strong><span class=\"has-inline-color has-vivid-red-color\">D8<\/span><\/strong> du syst\u00e8me d&rsquo;alarme (Uno) au port <strong><span class=\"has-inline-color has-vivid-red-color\">UART2<\/span><\/strong> de la centrale de surveillance (Mega).<\/li><\/ul>\n\n\n\n<h3 class=\"has-vivid-red-color has-text-color wp-block-heading\">3.2 &#8211; Utilisation d&rsquo;un type &lsquo;<span class=\"has-inline-color has-vivid-cyan-blue-color\">enum<\/span>&lsquo; pour l&rsquo;identification des messages<\/h3>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Ajouter<\/span><\/strong> au dossier de votre projet, le fichier &lsquo;<strong><span class=\"has-inline-color has-vivid-red-color\">code.alarme.h<\/span><\/strong>&lsquo; suivant:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/*\n    Fichier:  code.alarme.h\n    Auteur:   Alain Boudreault\n    Date:     2021.11.21\n    ---------------------------------------------------------\n    Description:  D\u00e9finir un type enum \u00e0 utiliser pour les\n                  diff\u00e9rents \u00e9tats du syst\u00e8me d'alarme.\n\n                  Note: Inclure ce fichier dans le dossier de\n                        votre projet.\n\n                        Puis, programmer la syntaxe suivante \n                        pour utiliser ce type:\n\n                        codesAlarme code;\n                        ...\n                        code = evenement_systeme_enligne;\n    ---------------------------------------------------------\n    M-A-J:\n    ---------------------------------------------------------\n*\/\n\n\/\/ S'assurer que ce fichier ne sera inclus qu'une seule fois lors de la compilation du projet\n#ifndef LES_CODES_ERREUR_H\n#define LES_CODES_ERREUR_H\nenum codesAlarme {\n  evenement_temperature_depassee,\n  evenement_dectection_mouvement,\n  evenement_code_invalide,\n  evenement_code_valide,\n  evenement_alarme_active,\n  evenement_alarme_inactive,\n  evenement_systeme_enligne\n};\n#endif \/\/ LES_CODES_ERREUR_H_ _<\/pre>\n\n\n\n<p class=\"has-text-align-left\"><strong><span class=\"has-inline-color has-vivid-red-color\">NOTE<\/span><\/strong>: Pour que ce fichier soit disponible pour tous vos projets, il est possible de cr\u00e9er un dossier &lsquo;mestrucs&rsquo;  dans le dossier Documents\/Arduino\/libraries.  Par exemple, C:\\Users\\Alain\\Documents\\Arduino\\libraries\\mestrucs et y placer le fichier.h.<\/p>\n\n\n\n<h3 class=\"has-vivid-red-color has-text-color wp-block-heading\">3.2.1 &#8211; Exemple d&rsquo;utilisation du type &lsquo;CodesAlarme&rsquo; et transmission de messages entre deux Arduino:<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">Pour le Arduino UNO (Syst\u00e8me d&rsquo;alarme)<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/*\n    Simulation d'un syst\u00e8me d'alarme UNO, qui envoie des \u00e9v\u00e9nements\n    \u00e0 une centrale de controle (MEGA) via le protocole UART.\n\n    Le UNO est connect\u00e9 par son port D8 au port UART2 du MEGA.\n\n    \u00c9tant donn\u00e9 que le UNO n'a qu'un seul port UART et qu'il est utilis\u00e9\n    pour d\u00e9boger l'application, la librairie 'SoftwareSerial' est utilis\u00e9e\n    pour simuler un port UART \u00e0 partir d'une GPIO.\n\n*\/\n\n#include &lt;SoftwareSerial.h>\n#include \"code.alarme.h\"\n\n\/\/ Le RX du UNO doit \u00eatre connect\u00e9 au TX du MEGA et TX -> RX\n\/\/ Il faut donc inverser les signaux:\nSoftwareSerial mySerial(9, 8); \/\/ RX, TX\n\ncodesAlarme unCodeAlarme = evenement_systeme_enligne;\n\nvoid setup() {\n  Serial.begin(9600);\n  while (!Serial) {\n    ; \/\/ S'assurer que le port serie est pret.  Ceci n'est pas requis pour un SoftwareSerial.\n  }\n  Serial.println(\"Demarrage du systeme d'alarme...\");\n  \n  \/\/ Initialiser le port serie 'SoftwareSerial'\n  mySerial.begin(9600);\n\n  \/\/ Envoyer l'\u00e9tat du syst\u00e8me d'alarme \u00e0 la centrale (Mega)\n  mySerial.write(unCodeAlarme); \/\/ Attention, pour envoyer un seul octet (Byte), il faut utiliser la m\u00e9thode write et non pas print.\n  delay(1000);\n}\n\nvoid loop() {  \n  unCodeAlarme = evenement_dectection_mouvement;\n  \/\/ Envoyer un code de d\u00e9tection du mouvement \u00e0 toutes les secondes:\n   mySerial.write(unCodeAlarme);\n   delay(1000);\n\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"> Pour le Arduino MEGA(Centrale de contr\u00f4le) <\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/*\n\n  Code pour l'Arduino Mega.\n\n  R\u00e9ception de codes d'\u00e9v\u00e9nement, envoy\u00e9s par le UNO, par le port UART2\n\n*\/\n#include \"code.alarme.h\"\n\n#define  VITESSE_DU_PORT_SERIAL     9600\n#define  PORT_DE_CONNEXION_DU_UNO   Serial2\nvoid setup() {\n  Serial.begin (VITESSE_DU_PORT_SERIAL);  \/\/ Port s\u00e9rie pour la console de d\u00e9bogage\n  PORT_DE_CONNEXION_DU_UNO.begin(VITESSE_DU_PORT_SERIAL);  \/\/ Port s\u00e9rie pour la r\u00e9ception des codes du client UNO\n\n  while (!PORT_DE_CONNEXION_DU_UNO) {\n    ; \/\/ Par pr\u00e9caution, s'assurer que le port Serial2 est pr\u00eat\n  }\n\n  Serial.println(\"D\u00e9marrage de la centrale de surveillance...\");\n}\n\nvoid loop() {\n  codesAlarme code;\n  if (PORT_DE_CONNEXION_DU_UNO.available()) {\n    code = PORT_DE_CONNEXION_DU_UNO.read();\n    \/\/ afficher la valeur du byte re\u00e7u\n    Serial.print(\"\\nCode = \"); Serial.print(code, DEC); Serial.println(\"\");\n  \n    \/\/ Tester les \u00e9v\u00e9nements du syst\u00e8me d'alarme\n    if (code == evenement_systeme_enligne) Serial.print(\"Systeme client en ligne !\");\n    if (code == evenement_dectection_mouvement) Serial.print(\"DANGER: Il y a intrusion ....\");\n\n    \n  }\n}\n<\/pre>\n\n\n\n<h3 class=\"has-vivid-red-color has-text-color wp-block-heading\">3.3 &#8211; Gestion des \u00e9v\u00e9nements entre UNO et MEGA<\/h3>\n\n\n\n<p>Le &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">buzzer<\/span><\/strong>&lsquo; \u00e9tant maintenant connect\u00e9 au <strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Arduino Mega<\/span><\/strong>, pour le faire <strong><span class=\"has-inline-color has-vivid-red-color\">sonner<\/span><\/strong>, il faut envoyer des codes d&rsquo;\u00e9tat du &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">UNO<\/span><\/strong>&lsquo; vers le &lsquo;<strong><span class=\"has-inline-color has-vivid-cyan-blue-color\">Mega<\/span><\/strong>&lsquo;.<\/p>\n\n\n\n<p>Voici la liste des \u00e9tats \u00e0 traiter:<\/p>\n\n\n\n<div class=\"wp-block-getwid-table\"><table><tbody><tr><td>Code de l&rsquo;\u00e9v\u00e9nement<\/td><td>D\u00e9tail<\/td><td>alarme<\/td><\/tr><tr><td>evenement_systeme_enligne<\/td><td>Envoyer \u00e0 la fin de la fonction setup()<\/td><td>2 beeps rapides<\/td><\/tr><tr><td>evenement_alarme_inactive<\/td><td>Envoyer apr\u00e8s le d\u00e9lai du msg &lsquo;Dormez en paix&rsquo;<\/td><td>1 long beep<\/td><\/tr><tr><td>evenement_alarme_active<\/td><td>Envoyer apr\u00e8s avoir afficher<br> l&rsquo;\u00e9cran de l&rsquo;\u00e9tape 2.1<\/td><td>Afficher dans la<br>console du Mega:<br><br>Syst\u00e8me activ\u00e9<\/td><\/tr><tr><td>evenement_code_valide<\/td><td>Envoyer si le code du syst\u00e8me<br>est valide<\/td><td>1 beep rapide<\/td><\/tr><tr><td>evenement_code_invalide<\/td><td>Envoyer si le code du syst\u00e8me <br>est invalide<\/td><td>3 beeps rapides<\/td><\/tr><tr><td>evenement_dectection_mouvement<\/td><td>Envoyer si le d\u00e9tecteur de mouvement <br>est activ\u00e9.<br><strong>Note<\/strong>: ne pas renvoyer tant que <br>le d\u00e9tecteur demeure actif<\/td><td>4 beeps rapides<\/td><\/tr><tr><td>evenement_temperature_depassee<\/td><td>Envoyer si la temp\u00e9rature d\u00e9passe <br>TEMP_<br><strong>Note<\/strong>: ne pas renvoyer tant que <br>la temp\u00e9rature est \u00e9lev\u00e9e<\/td><td>5 beeps rapides<\/td><\/tr><\/tbody><\/table><\/div>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">NOTE<\/span><\/strong>: beep long = une seconde, beep rapide = 1\/2 seconde <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"has-text-color wp-block-heading\" style=\"color:#29567b\"><br>Semaine 04 &#8211; Compl\u00e9ter le projet (6 d\u00e9cembre)<\/h2>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"396\" src=\"http:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/connected.png\" alt=\"\" class=\"wp-image-1786\" srcset=\"https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/connected.png 512w, https:\/\/ve2cuy.com\/420-1c4\/wp-content\/uploads\/2021\/11\/connected-300x232.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"has-vivid-red-color has-text-color wp-block-heading\">Remise du projet: mardi le 14 d\u00e9cembre 2021<br><br><\/h2>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h6 class=\"has-text-align-right has-vivid-cyan-blue-color has-text-color wp-block-heading\">Document par Alain Boudreault &#8211; aka VE2CUY version 2021.11.28.01<\/h6>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00c9nonc\u00e9 2021.11.28.01 du projet de l&rsquo;\u00e9preuve synth\u00e8se Version finale de l&rsquo;\u00e9nonc\u00e9. Pond\u00e9ration : 50% Date de remise: mardi le 14 d\u00e9cembre 2021 \u00c0 chaque semaine, ce document fournira des informations suppl\u00e9mentaires pour la r\u00e9alisation du projet de session. Contexte de r\u00e9alisation \u00c0 partir d&rsquo;un Arduino Uno, d&rsquo;un Arduino Mega (semaine 03 du projet) d&rsquo;un module [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ub_ctt_via":"","footnotes":""},"class_list":["post-1626","page","type-page","status-publish","hentry"],"featured_image_src":null,"_links":{"self":[{"href":"https:\/\/ve2cuy.com\/420-1c4\/index.php\/wp-json\/wp\/v2\/pages\/1626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ve2cuy.com\/420-1c4\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ve2cuy.com\/420-1c4\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ve2cuy.com\/420-1c4\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ve2cuy.com\/420-1c4\/index.php\/wp-json\/wp\/v2\/comments?post=1626"}],"version-history":[{"count":163,"href":"https:\/\/ve2cuy.com\/420-1c4\/index.php\/wp-json\/wp\/v2\/pages\/1626\/revisions"}],"predecessor-version":[{"id":1847,"href":"https:\/\/ve2cuy.com\/420-1c4\/index.php\/wp-json\/wp\/v2\/pages\/1626\/revisions\/1847"}],"wp:attachment":[{"href":"https:\/\/ve2cuy.com\/420-1c4\/index.php\/wp-json\/wp\/v2\/media?parent=1626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}