{"id":6116,"date":"2021-03-30T13:56:28","date_gmt":"2021-03-30T11:56:28","guid":{"rendered":"https:\/\/www.ardpylab.fr\/?page_id=6116"},"modified":"2021-04-07T11:52:51","modified_gmt":"2021-04-07T09:52:51","slug":"categorie-relais","status":"publish","type":"page","link":"https:\/\/www.ardpylab.fr\/?page_id=6116","title":{"rendered":"Cat\u00e9gorie \u00ab Relais \u00bb"},"content":{"rendered":"\n<p><br>Cette cat\u00e9gorie regroupe des sketchs utilisant des relais.<br><br><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"333\" height=\"318\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/ListeSketch08.png\" alt=\"\" class=\"wp-image-6117\" srcset=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/ListeSketch08.png 333w, https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/ListeSketch08-300x286.png 300w\" sizes=\"auto, (max-width: 333px) 100vw, 333px\" \/><\/figure><\/div>\n\n\n\n<h4>&nbsp;<\/h4>\n<h4><strong>1. <span style=\"text-decoration: underline;\"><a href=\"https:\/\/www.ardpylab.fr\/downloads\/ardpylog\/Relais_SPDT.zip\">Relais_SPDT<\/a><br><br><\/span><\/strong><\/h4>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/Relais_SPDT.jpg\" alt=\"\" class=\"wp-image-6118\" width=\"468\" height=\"283\" srcset=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/Relais_SPDT.jpg 935w, https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/Relais_SPDT-300x181.jpg 300w, https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/Relais_SPDT-768x464.jpg 768w\" sizes=\"auto, (max-width: 468px) 100vw, 468px\" \/><\/figure><\/div>\n\n\n\n<p>&nbsp;<\/p>\n<p>L\u2019objectif de cette activit\u00e9 est d\u2019allumer la DEL rouge ou la DEL verte avec un bouton poussoir et un <a href=\"https:\/\/www.ardpylab.fr\/?page_id=1441\/#relais\">relais SPDT<\/a>:<\/p>\n<p>\u2013 bouton rel\u00e2ch\u00e9 : La DEL rouge est allum\u00e9e et la DEL verte est \u00e9teinte,<br>\u2013 bouton appuy\u00e9 : La DEL verte est allum\u00e9e et la DEL rouge est \u00e9teinte.<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 100%; padding-left: 40px;\">\n<p>\/\/ D\u00e9claration des constantes et variables<\/p>\n<p>const int buttonPin = 12;<br>const int relayPin = 2;<\/p>\n<p><br>\/\/ Initialisation des entr\u00e9es et sorties<\/p>\n<p>void setup()<br>{<br>pinMode(relayPin, OUTPUT);<br>pinMode(buttonPin, INPUT);<br>}<\/p>\n<p><br>\/\/ Fonction principale en boucle<\/p>\n<p>void loop()<br>{<br>int buttonState = digitalRead(buttonPin);<br><br>if (buttonState == 1) <br>{<br>digitalWrite(relayPin, HIGH); <br>}<br>else <br>{<br>digitalWrite(relayPin, LOW); <br>}<br>delay(10);<br>}<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n\n<p>\u00a0<\/p>\n<h4><strong>2. <a href=\"https:\/\/www.ardpylab.fr\/downloads\/ardpylog\/Relais_SPST.zip\"><span style=\"text-decoration: underline;\">Relais_SPST<\/span><\/a><br \/><br \/><\/strong><\/h4>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/Relais_SPST.jpg\" alt=\"\" class=\"wp-image-6120\" width=\"468\" height=\"283\" srcset=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/Relais_SPST.jpg 935w, https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/Relais_SPST-300x181.jpg 300w, https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2021\/03\/Relais_SPST-768x464.jpg 768w\" sizes=\"auto, (max-width: 468px) 100vw, 468px\" \/><\/figure><\/div>\n\n\n\n<p>&nbsp;<\/p>\n<p>L\u2019objectif de cette activit\u00e9 est de contr\u00f4ler un moteur \u00e0 courant continu fonctionnant sous 9 V \u00e0 l&rsquo;aide d&rsquo;un Arduino Uno et d&rsquo;un <a href=\"https:\/\/www.ardpylab.fr\/?page_id=1441\/#relais\">relais SPST<\/a> (\u00ab Single pole single throw \u00bb) reli\u00e9 \u00e0 la sortie digitale 2 de l\u2019Arduino.<\/p>\n<p>Avec le circuit de l&rsquo;activit\u00e9, quand la sortie digitale 2 de l\u2019Arduino est \u00e0 un niveau bas, le relais agit comme un interrupteur ouvert, le circuit du moteur est donc ouvert et le moteur ne tourne pas. Au contraire, quand la sortie digitale 2 est \u00e0 un niveau haut, le relais fait contact, la DEL du module s\u2019allume, le circuit du moteur est ferm\u00e9 et le moteur tourne.<\/p>\n<p>C\u2019est avec le bouton poussoir qu\u2019on donnera l\u2019ordre \u00e0 l\u2019Arduino d\u2019allumer ou d\u2019\u00e9teindre le moteur :<\/p>\n<p>\u2013 bouton appuy\u00e9 : le moteur tourne (sortie digitale 2 \u00e0 HIGH),<br>\u2013 bouton rel\u00e2ch\u00e9 : le moteur est arr\u00eat\u00e9 (sortie digitale 2 \u00e0 LOW).<\/p>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 100%; padding-left: 40px;\">\n<p>\/\/ D\u00e9claration des constantes et variables<\/p>\n<p>const int buttonPin = 12;<br>const int relayPin = 2;<\/p>\n<p><br>\/\/ Initialisation des entr\u00e9es et sorties<\/p>\n<p>void setup()<br>{<br>pinMode(relayPin, OUTPUT);<br>pinMode(buttonPin, INPUT);<br>}<\/p>\n<p><br>\/\/ Fonction principale en boucle<\/p>\n<p>void loop()<br>{<br>int buttonState = digitalRead(buttonPin);<br><br>if (buttonState == 1) <br>{<br>digitalWrite(relayPin, HIGH); <br>}<br>else <br>{<br>digitalWrite(relayPin, LOW); <br>}<br>delay(10);<br>}<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n\n<p><br \/>\u00a0<\/p>\n\n\n<div  class=\"grids-section grids-is-advanced\" style=\"--_gs-gap-desktop:0px 0px;--_gs-m-desktop:0 0 0 0;--_gs-p-desktop:0 0 0 0;--_gs-bg-desktop:transparent none;--_gs-bg-xp-desktop:0px;--_gs-zi-desktop:auto;--_gs-d-desktop:block;--_gs-mw-desktop:calc(100% - 0 - 0);--_gs-gap-tablet:0px 0px;--_gs-m-tablet:0 0 0 0;--_gs-p-tablet:0 0 0 0;--_gs-bg-tablet:transparent none;--_gs-bg-xp-tablet:0px;--_gs-zi-tablet:auto;--_gs-d-tablet:block;--_gs-mw-tablet:calc(100% - 0 - 0);--_gs-gap-mobile:0px 0px;--_gs-m-mobile:0 0 0 0;--_gs-p-mobile:0 0 0 0;--_gs-bg-mobile:transparent none;--_gs-bg-xp-mobile:0px;--_gs-zi-mobile:auto;--_gs-d-mobile:block;--_gs-mw-mobile:calc(100% - 0 - 0);--_gs-columns:12;--_gs-rows:6\"><div class=\"grids-s-w_i\">\n<div class=\"grids-area\" style=\"--_ga-column:1\/2;--_ga-row:1\/2;--_ga-m-desktop:0 0 0 0;--_ga-p-desktop:0 0 0 0;--_ga-bg-desktop:transparent none;--_ga-zi-desktop:auto;--_ga-d-desktop:flex;--_ga-mw-desktop:calc(100% - 0 - 0);--_ga-m-tablet:0 0 0 0;--_ga-p-tablet:0 0 0 0;--_ga-bg-tablet:transparent none;--_ga-zi-tablet:auto;--_ga-d-tablet:flex;--_ga-mw-tablet:calc(100% - 0 - 0);--_ga-m-mobile:0 0 0 0;--_ga-p-mobile:0 0 0 0;--_ga-bg-mobile:transparent none;--_ga-zi-mobile:auto;--_ga-d-mobile:flex;--_ga-mw-mobile:calc(100% - 0 - 0)\">\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.ardpylab.fr\/?page_id=6098\"><img loading=\"lazy\" decoding=\"async\" width=\"50\" height=\"28\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/03\/moins.jpg\" alt=\"\" class=\"wp-image-107\"\/><\/a><\/figure>\n\n<\/div>\n\n<div class=\"grids-area\" style=\"--_ga-column:12\/13;--_ga-row:1\/2;--_ga-m-desktop:0 0 0 0;--_ga-p-desktop:0 0 0 0;--_ga-bg-desktop:transparent none;--_ga-zi-desktop:auto;--_ga-d-desktop:flex;--_ga-mw-desktop:calc(100% - 0 - 0);--_ga-m-tablet:0 0 0 0;--_ga-p-tablet:0 0 0 0;--_ga-bg-tablet:transparent none;--_ga-zi-tablet:auto;--_ga-d-tablet:flex;--_ga-mw-tablet:calc(100% - 0 - 0);--_ga-m-mobile:0 0 0 0;--_ga-p-mobile:0 0 0 0;--_ga-bg-mobile:transparent none;--_ga-zi-mobile:auto;--_ga-d-mobile:flex;--_ga-mw-mobile:calc(100% - 0 - 0)\">\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.ardpylab.fr\/?page_id=6141\"><img loading=\"lazy\" decoding=\"async\" width=\"50\" height=\"28\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/03\/plus.jpg\" alt=\"\" class=\"wp-image-106\"\/><\/a><\/figure>\n\n<\/div>\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Cette cat\u00e9gorie regroupe des sketchs utilisant des relais. &nbsp; 1. Relais_SPDT &nbsp; L\u2019objectif de cette activit\u00e9 est d\u2019allumer la DEL rouge ou la DEL verte avec un bouton poussoir et un relais SPDT: \u2013 bouton rel\u00e2ch\u00e9 : La DEL rouge est allum\u00e9e et la DEL verte est \u00e9teinte,\u2013 bouton appuy\u00e9 : La DEL verte est [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6116","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/pages\/6116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6116"}],"version-history":[{"count":7,"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/pages\/6116\/revisions"}],"predecessor-version":[{"id":6307,"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/pages\/6116\/revisions\/6307"}],"wp:attachment":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}