{"id":439,"date":"2020-03-23T11:54:27","date_gmt":"2020-03-23T10:54:27","guid":{"rendered":"http:\/\/www.ardpylab.fr\/?page_id=439"},"modified":"2020-05-09T20:26:11","modified_gmt":"2020-05-09T18:26:11","slug":"activite-1","status":"publish","type":"page","link":"https:\/\/www.ardpylab.fr\/?page_id=439","title":{"rendered":"Ondes sonores &#8211; Activit\u00e9 1"},"content":{"rendered":"\n<h2 style=\"text-align: center;\"><em>\u201d <\/em><span style=\"text-decoration: underline;\"><em>Faire clignoter une DEL et produire un \u00ab\u00a0beep\u00a0\u00bb synchrone<\/em><\/span> <em>\u201d<br><br><\/em><\/h2>\n\n\n\n<h4>&nbsp;<\/h4>\n<h4><span style=\"color: #3366ff;\"><strong>. <span style=\"text-decoration: underline;\">Objectif<\/span><\/strong><\/span><\/h4>\n\n\n\n<p>Dans cette activit\u00e9, nous allons modifier notre premier programme des activit\u00e9s d&rsquo;apprentissage qui permet de faire clignoter une DEL, pour commander la production d&rsquo;un signal sonore (\u00ab\u00a0un beep\u00a0\u00bb), \u00e9mis par un buzzer ou un petit haut-parleur, synchrone avec le clignotement de la diode, avec notre circuit d&rsquo;\u00e9tude des <a href=\"https:\/\/www.ardpylab.fr\/?page_id=424\">ondes sonores<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-434\" style=\"border: 3px solid #eeeeee; padding: 3px; margin: 3px;\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/03\/Circuit-ondes-sonores.jpg\" alt=\"\" width=\"568\" height=\"327\"><\/figure>\n<\/div>\n<p>&nbsp;<\/p>\n\n\n\n<h4><span style=\"color: #3366ff;\"><strong><br>. <span style=\"text-decoration: underline;\">Le programme<\/span><\/strong><\/span><\/h4>\n\n\n\n<p><a href=\"https:\/\/www.ardpylab.fr\/downloads\/ondes-sonores\/activity1.zip\" data-wplink-url-error=\"true\">Le programme de l\u2019activit\u00e9<\/a> pourra \u00eatre modifi\u00e9 pour voir l\u2019influence des variables (dur\u00e9e d\u2019allumage et d\u2019extinction, fr\u00e9quence en Hz de l\u2019onde sonore)&nbsp;:<\/p>\n\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.ardpylab.fr\/downloads\/ondes-sonores\/Activity1\/Activity1.ino\"><img loading=\"lazy\" decoding=\"async\" width=\"504\" height=\"507\" class=\"wp-image-445 aligncenter\" style=\"border: 3px solid #eeeeee; padding: 3px; margin: 3px;\" src=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/03\/ondes-sonores-activity1.png\" alt=\"\" srcset=\"https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/03\/ondes-sonores-activity1.png 504w, https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/03\/ondes-sonores-activity1-298x300.png 298w, https:\/\/www.ardpylab.fr\/wp-content\/uploads\/2020\/03\/ondes-sonores-activity1-150x150.png 150w\" sizes=\"auto, (max-width: 504px) 100vw, 504px\" \/><\/a><\/figure>\n<\/div>\n<p>&nbsp;<\/p>\n\n\n\n<p><strong><u>D\u00e9roulement du programme<\/u><\/strong><strong>\u00a0:<\/strong><\/p>\n<p>&#8211; D\u00e9claration des constantes et variables\u00a0:<\/p>\n<p style=\"padding-left: 40px;\">. <strong>const int PinLed = 9 <\/strong>\u00a0(constante nombre entier correspondant au n\u00b0 de la broche sur laquelle la DEL rouge est connect\u00e9e)<\/p>\n<p style=\"padding-left: 40px;\">. <strong>const int PinTone = 8 <\/strong>\u00a0(constante nombre entier correspondant au n\u00b0 de la broche sur laquelle le buzzer est connect\u00e9)<\/p>\n<p style=\"padding-left: 40px;\">. <strong>const int FreqTone = 440 <\/strong>(constante nombre entier correspondant \u00e0 la fr\u00e9quence en Hz de l\u2019onde sonore)<\/p>\n<p style=\"padding-left: 40px;\">. <strong>const int TimeSleep1 = 500 <\/strong>\u00a0(constante nombre entier correspondant \u00e0 la dur\u00e9e d\u2019allumage de la DEL en ms)<\/p>\n<p style=\"padding-left: 40px;\">. <strong>const int TimeSleep2 = 500 <\/strong>\u00a0(constante nombre entier correspondant \u00e0 la dur\u00e9e d\u2019extinction de la DEL en ms)<br \/><br \/><\/p>\n<p>&#8211; Initialisation des entr\u00e9es et sorties\u00a0:<\/p>\n<p style=\"padding-left: 40px;\">. La broche de la DEL est initialis\u00e9e en sortie digitale. Des donn\u00e9es seront donc envoy\u00e9s depuis le microcontr\u00f4leur vers cette broche\u00a0:<br \/><strong>pinMode(PinLed, OUTPUT)<br \/><br \/><\/strong><\/p>\n<p>&#8211; Fonction principale en boucle\u00a0:<\/p>\n<p style=\"padding-left: 40px;\">. Niveau haut sur la broche de la Del\u00a0: <strong>digitalWrite(PinLed, HIGH)<\/strong><\/p>\n<p style=\"padding-left: 40px;\"><strong>. <\/strong>Emission de l\u2019onde sonore en continu\u00a0: <strong>tone(PinTone,FreqTone)<\/strong><\/p>\n<p style=\"padding-left: 40px;\">. Attente pendant TimeSleep1 ms\u00a0: <strong>delay(TimeSleep1)<\/strong><\/p>\n<p style=\"padding-left: 40px;\">. Niveau bas sur la broche de la Del\u00a0: <strong>digitalWrite(PinLed, Low)<\/strong><\/p>\n<p style=\"padding-left: 40px;\"><strong>. <\/strong>Arr\u00eat de l\u2019\u00e9mission sonore\u00a0:<strong> notone(PinTone)<\/strong><\/p>\n<p style=\"padding-left: 40px;\">. Attente pendant TimeSleep2 ms\u00a0: <strong>delay(TimeSleep2)<\/strong><\/p>\n<p>\u00a0<\/p>\n\n\n<div  class=\"grids-section grids-is-stretch\" 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:2;--_gs-rows:1\"><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<div class=\"wp-block-image\"><figure class=\"alignleft size-large\"><a href=\"https:\/\/www.ardpylab.fr\/?page_id=424\"><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><\/div>\n\n<\/div>\n\n<div class=\"grids-area\" style=\"--_ga-column:2\/3;--_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<div class=\"wp-block-image\"><figure class=\"alignright size-large\"><a href=\" https:\/\/www.ardpylab.fr\/?page_id=460\"><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><\/div>\n\n<\/div>\n<\/div><\/div>\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>\u201d Faire clignoter une DEL et produire un \u00ab\u00a0beep\u00a0\u00bb synchrone \u201d &nbsp; . Objectif Dans cette activit\u00e9, nous allons modifier notre premier programme des activit\u00e9s d&rsquo;apprentissage qui permet de faire clignoter une DEL, pour commander la production d&rsquo;un signal sonore (\u00ab\u00a0un beep\u00a0\u00bb), \u00e9mis par un buzzer ou un petit haut-parleur, synchrone avec le clignotement de [&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-439","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/pages\/439","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=439"}],"version-history":[{"count":0,"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=\/wp\/v2\/pages\/439\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ardpylab.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}