{"id":88356,"date":"2020-03-05T14:29:20","date_gmt":"2020-03-05T13:29:20","guid":{"rendered":"http:\/\/fabnum.tech\/?p=88356"},"modified":"2020-06-17T15:26:21","modified_gmt":"2020-06-17T13:26:21","slug":"portfolio-lise-5-exercice-du-parking-arduino","status":"publish","type":"post","link":"https:\/\/fabnum.tech\/index.php\/2020\/03\/05\/portfolio-lise-5-exercice-du-parking-arduino\/","title":{"rendered":"Portfolio Lise #5 &#8211; Exercice du parking (Arduino)"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_custom_heading css_animation=\u00a0\u00bbtypewriter\u00a0\u00bb]<\/p>\n<h2>Pr\u00e9sentation du projet<\/h2>\n<p>[\/vc_custom_heading][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_column_text css_animation=\u00a0\u00bbtop-t-bottom\u00a0\u00bb]Le but du projet \u00e9tait de r\u00e9aliser un <strong>parking avec 5 places disponibles.<\/strong><\/p>\n<p>Lorsque le parking est plein, la LED rouge s&rsquo;allume et tant qu&rsquo;il reste des places vacantes la LED verte reste allum\u00e9e.<\/p>\n<p>C&rsquo;est un projet r\u00e9alis\u00e9 \u00e0 l&rsquo;aide des logiciels <strong>Arduino et Fritzing que je vais pr\u00e9senter<\/strong> tout au long de l&rsquo;article.[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_custom_heading css_animation=\u00a0\u00bbsingle-curtain\u00a0\u00bb]Utilisation de Fritzing[\/vc_custom_heading][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/2&Prime;][vc_single_image media=\u00a0\u00bb88745&Prime; media_width_percent=\u00a0\u00bb100&Prime; alignment=\u00a0\u00bbcenter\u00a0\u00bb shape=\u00a0\u00bbimg-round\u00a0\u00bb radius=\u00a0\u00bbstd\u00a0\u00bb shadow=\u00a0\u00bbyes\u00a0\u00bb shadow_weight=\u00a0\u00bbstd\u00a0\u00bb css_animation=\u00a0\u00bbleft-t-right\u00a0\u00bb][\/vc_column][vc_column width=\u00a0\u00bb1\/2&Prime;][vc_column_text css_animation=\u00a0\u00bbright-t-left\u00a0\u00bb]Tout d&rsquo;abord,<strong> Fritzing<\/strong>\u00a0<img decoding=\"async\" class=\"\" src=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/a\/a8\/Fritzing_icon_%28new%29.png\" alt=\"\" width=\"19\" height=\"19\" \/> est un<strong> logiciel qui permet de r\u00e9aliser des circuits et des sch\u00e9mas.<br \/>\n<\/strong><\/p>\n<p>Ce logiciel se pr\u00e9sente comme sur<strong> l&rsquo;image ci-contre.<\/strong> La partie de gauche<em> (la platine d&rsquo;essai) <\/em>permet de d\u00e9poser les composants s\u00e9lectionn\u00e9s \u00e0 droite.<\/p>\n<p>Il y a pleins de composants comme des cartes Arduino, des LED, des r\u00e9sistances, des piles etc.<\/p>\n<p>Il s&rsquo;agit d&rsquo;un logiciel<strong> tr\u00e8s pratique et tr\u00e8s simple d&rsquo;utilisation.<\/strong>[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/2&Prime;][vc_column_text css_animation=\u00a0\u00bbleft-t-right\u00a0\u00bb]Lors de ce projet, j&rsquo;ai utilis\u00e9 Fritzing afin de <strong>visualiser mon circuit<\/strong> avant de le monter et de coder. Il est compos\u00e9 :<\/p>\n<ul>\n<li>d&rsquo;une <strong>LED verte<\/strong> (allum\u00e9e lorsque le parking est vide)<\/li>\n<li>d&rsquo;une <strong>LED rouge<\/strong> (allum\u00e9e lorsque le parking est plein)<\/li>\n<li>d&rsquo;un<strong> bouton entr\u00e9e<\/strong> (un appui = un v\u00e9hicule entr\u00e9)<\/li>\n<li>d&rsquo;un <strong>bouton sortie<\/strong> ( un appui = un v\u00e9hicule sorti)<\/li>\n<li>de <strong>9 fils<\/strong><\/li>\n<li>d&rsquo;une carte<strong> Arduino uno<\/strong><\/li>\n<\/ul>\n<p>Suite \u00e0 cela, j&rsquo;ai pu passer au code et au montage de mon circuit.[\/vc_column_text][\/vc_column][vc_column width=\u00a0\u00bb1\/2&Prime;][vc_single_image media=\u00a0\u00bb88748&Prime; media_width_percent=\u00a0\u00bb78&Prime; alignment=\u00a0\u00bbcenter\u00a0\u00bb shape=\u00a0\u00bbimg-round\u00a0\u00bb radius=\u00a0\u00bbstd\u00a0\u00bb shadow=\u00a0\u00bbyes\u00a0\u00bb shadow_weight=\u00a0\u00bbstd\u00a0\u00bb css_animation=\u00a0\u00bbright-t-left\u00a0\u00bb][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_custom_heading css_animation=\u00a0\u00bbsingle-curtain\u00a0\u00bb]Utilisation du logiciel Arduino[\/vc_custom_heading][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_column_text css_animation=\u00a0\u00bbtop-t-bottom\u00a0\u00bb animation_delay=\u00a0\u00bb1000&Prime;]Le<strong> logiciel Arduino<\/strong> <img decoding=\"async\" class=\"\" src=\"https:\/\/encrypted-tbn0.gstatic.com\/images?q=tbn%3AANd9GcTzWq0plKu0eBdtVCFMgxiSlXFFnKZMoj9WQjKjd8Hx8O79AuIt\" alt=\"\" width=\"27\" height=\"27\" \/> est un logiciel qui permet d&rsquo;\u00e9crire et t\u00e9l\u00e9charger des programmes sur des cartes compatibles Arduino.<\/p>\n<p>Pour le parking, je l&rsquo;ai utilis\u00e9 pour coder les entr\u00e9es et les sorties des v\u00e9hicules.[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/2&Prime;][vc_single_image media=\u00a0\u00bb88753&Prime; media_width_percent=\u00a0\u00bb100&Prime; alignment=\u00a0\u00bbcenter\u00a0\u00bb shape=\u00a0\u00bbimg-round\u00a0\u00bb radius=\u00a0\u00bbstd\u00a0\u00bb shadow=\u00a0\u00bbyes\u00a0\u00bb shadow_weight=\u00a0\u00bblg\u00a0\u00bb css_animation=\u00a0\u00bbleft-t-right\u00a0\u00bb][\/vc_column][vc_column width=\u00a0\u00bb1\/2&Prime;][vc_column_text css_animation=\u00a0\u00bbright-t-left\u00a0\u00bb]Voici une partie du code<em> (il s&rsquo;agit du d\u00e9but).<\/em><\/p>\n<p>C&rsquo;est du code \u00e9crit avec des fonctions <strong>en langages C et C++.<\/strong><\/p>\n<p>J&rsquo;ai commenc\u00e9 par mettre <strong>du commentaire<\/strong> <em>( gr\u00e2ce au \/\/)<\/em> au d\u00e9part pour pr\u00e9senter le code (et surtout ne pas oublier de quoi il s&rsquo;agit). Ensuite j&rsquo;ai<strong> initialis\u00e9 mes constantes.<\/strong><\/p>\n<p><strong>Les codes se pr\u00e9sentent pratiquement tous pareil<\/strong> ( pr\u00e9sentation, initialisation des constantes et des variables, boucle principale etc.)[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_column_text css_animation=\u00a0\u00bbleft-t-right\u00a0\u00bb]<strong>Le code est trop long<\/strong> pour que je le montre enti\u00e8rement, mais j&rsquo;ai:<\/p>\n<ul>\n<li><strong>initialis\u00e9 les constantes<\/strong><\/li>\n<li><strong>initialis\u00e9 les variables<\/strong> (\u00e9tat des boutons entr\u00e9 et sortie, ancien \u00e9tat des boutons et compteur).<\/li>\n<\/ul>\n<p><strong><img decoding=\"async\" class=\"size-full wp-image-88756 alignleft\" src=\"http:\/\/fabnum.tech\/wp-content\/uploads\/2020\/03\/Capture-constantes.png\" alt=\"\" width=\"217\" height=\"120\" \/><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong>initialis\u00e9 les broches LED <\/strong>en sortie<em> (OUTPUT) et\u00a0<\/em> les boutons poussoirs en <em>INPUT_PULLUP\u00a0<\/em><\/li>\n<li>d\u00e9finit<strong> la position de d\u00e9part<\/strong> : on part du principe que le parking est vide donc la LED verte est allum\u00e9e<em> (HIGH)<\/em> et la LED rouge est \u00e9teinte<em> (LOW)<\/em><\/li>\n<li>on termine le code avec des<strong> <em>if\/else<\/em><\/strong> qui permettent de r\u00e9agir \u00e0 tous les cas de figure<\/li>\n<\/ul>\n<p>[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_column_text css_animation=\u00a0\u00bbbottom-t-top\u00a0\u00bb animation_speed=\u00a0\u00bb500&Prime;]<strong>Quand on a fini de coder,<\/strong> on s\u2019assure que le code est bon. Pour ce faire, on utilise l&rsquo;outil \u00ab\u00a0v\u00e9rifier\u00a0\u00bb <img decoding=\"async\" class=\"alignnone size-full wp-image-88758\" src=\"http:\/\/fabnum.tech\/wp-content\/uploads\/2020\/03\/verifier.png\" alt=\"\" width=\"30\" height=\"33\" \/>\u00a0 qui permet de <strong>compiler le code<\/strong> et de nous montrer nos erreurs.<\/p>\n<p>Enfin on t\u00e9l\u00e9verse <img decoding=\"async\" class=\"alignnone size-full wp-image-88759\" src=\"http:\/\/fabnum.tech\/wp-content\/uploads\/2020\/03\/televerser.png\" alt=\"\" width=\"29\" height=\"32\" \/> vers la carte Arduino.[\/vc_column_text][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/2&Prime;][vc_column_text css_animation=\u00a0\u00bbleft-t-right\u00a0\u00bb]<\/p>\n<p>Voici ci-contre <strong>le montage que j&rsquo;ai r\u00e9alis\u00e9.<\/strong><\/p>\n<p><strong>Gr\u00e2ce au logiciel Fritzing, je savais d\u00e9j\u00e0 \u00e0 quoi ressemblerait mon circuit<\/strong> donc je n&rsquo;ai pas eu de difficult\u00e9 \u00e0 le faire.<\/p>\n<p><strong>Je l&rsquo;ai donc mont\u00e9<\/strong> avec le mat\u00e9riel mis \u00e0 disposition, <strong>tous les \u00e9l\u00e9ments pr\u00e9vus<\/strong> dans le sch\u00e9mas Fritzing y sont pr\u00e9sents : les LED verte et rouge, les 9 fils, la carte Arduino, et les deux boutons poussoirs.<\/p>\n<p><strong>La carte Arduino est branch\u00e9e<\/strong> \u00e0 l\u2019ordinateur <em>(gr\u00e2ce au c\u00e2ble USB que l&rsquo;on voit \u00e0 droite)<\/em> c&rsquo;est pour cela que la LED verte est allum\u00e9e.[\/vc_column_text][\/vc_column][vc_column width=\u00a0\u00bb1\/2&Prime;][vc_single_image media=\u00a0\u00bb88761&Prime; media_width_percent=\u00a0\u00bb61&Prime; alignment=\u00a0\u00bbcenter\u00a0\u00bb shape=\u00a0\u00bbimg-round\u00a0\u00bb shadow=\u00a0\u00bbyes\u00a0\u00bb shadow_weight=\u00a0\u00bbstd\u00a0\u00bb css_animation=\u00a0\u00bbright-t-left\u00a0\u00bb][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_column_text]<iframe src=\"https:\/\/www.dailymotion.com\/embed\/video\/x7sj3rd\" width=\"270\" height=\"480\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>Sur cette vid\u00e9o, on voit bien la <strong>situation initiale<\/strong> : LED verte et <strong>parking vide.<\/strong><br \/>\n<strong>En appuyant 5 fois sur le bouton entr\u00e9e<\/strong> pour simuler cinq entr\u00e9 de v\u00e9hicule, la LED rouge s&rsquo;allume pour signifier que <strong>le parking est plein.<\/strong>[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>[vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_custom_heading css_animation=\u00a0\u00bbtypewriter\u00a0\u00bb] Pr\u00e9sentation du projet [\/vc_custom_heading][\/vc_column][\/vc_row][vc_row][vc_column width=\u00a0\u00bb1\/1&Prime;][vc_column_text css_animation=\u00a0\u00bbtop-t-bottom\u00a0\u00bb]Le but du projet \u00e9tait de r\u00e9aliser un parking avec 5 places [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":88715,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[125],"tags":[],"class_list":["post-88356","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lise-emmanuelle-p9"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/fabnum.tech\/wp-content\/uploads\/2020\/03\/IMG-9764-scaled.jpg","_links":{"self":[{"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/posts\/88356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/comments?post=88356"}],"version-history":[{"count":20,"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/posts\/88356\/revisions"}],"predecessor-version":[{"id":101027,"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/posts\/88356\/revisions\/101027"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/media\/88715"}],"wp:attachment":[{"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/media?parent=88356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/categories?post=88356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fabnum.tech\/index.php\/wp-json\/wp\/v2\/tags?post=88356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}