{"id":28931,"date":"2026-05-12T16:28:02","date_gmt":"2026-05-12T16:28:02","guid":{"rendered":"https:\/\/retotech.fundacionendesa.org\/multisite\/?p=28931"},"modified":"2026-05-12T16:47:50","modified_gmt":"2026-05-12T16:47:50","slug":"4-apartat-programacio","status":"publish","type":"post","link":"https:\/\/retotech.fundacionendesa.org\/multisite\/2026\/05\/12\/4-apartat-programacio\/","title":{"rendered":"PROJECTE TASU &#8211; 4. Programaci\u00f3"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong>4.1. Estructura del codi<\/strong><\/h3>\n\n\n\n<p>Aquest codi:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Llegeix dist\u00e0ncia del sensor esquerre i dret<\/li>\n\n\n\n<li>Determina quin sensor detecta l\u2019obstacle m\u00e9s proper<\/li>\n\n\n\n<li>Mou el servo cap a l\u2019angle corresponent<\/li>\n\n\n\n<li>Calcula un angle interpolat si vols m\u00e9s precisi\u00f3<\/li>\n<\/ol>\n\n\n\n<p>A la plataforma bitbloq, el codi associat en forma de blocs seria el seg\u00fcent:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4.2. Desenvolupament (amb bitbloq Apps)<\/strong><\/h3>\n\n\n\n<p><strong>Secci\u00f3 de definici\u00f3 de variables:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"484\" height=\"211\" src=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Variables.png\" alt=\"\" class=\"wp-image-28938\" srcset=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Variables.png 484w, https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Variables-300x131.png 300w\" sizes=\"(max-width: 484px) 100vw, 484px\" \/><\/figure>\n\n\n\n<p><strong>Secci\u00f3 setup:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"590\" height=\"87\" src=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Setup.png\" alt=\"\" class=\"wp-image-28939\" srcset=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Setup.png 590w, https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Setup-300x44.png 300w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/figure>\n\n\n\n<p><strong>Secci\u00f3 loop:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"526\" src=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop1.png\" alt=\"\" class=\"wp-image-28940\" srcset=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop1.png 567w, https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop1-300x278.png 300w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"603\" height=\"233\" src=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop2.png\" alt=\"\" class=\"wp-image-28941\" srcset=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop2.png 603w, https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop2-300x116.png 300w, https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop2-600x233.png 600w\" sizes=\"(max-width: 603px) 100vw, 603px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"605\" height=\"237\" src=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop3.png\" alt=\"\" class=\"wp-image-28942\" srcset=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop3.png 605w, https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop3-300x118.png 300w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"604\" height=\"274\" src=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop4.png\" alt=\"\" class=\"wp-image-28943\" srcset=\"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop4.png 604w, https:\/\/retotech.fundacionendesa.org\/multisite\/wp-content\/uploads\/sites\/3\/2026\/05\/TASU-Loop4-300x136.png 300w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4.3. Desenvolupament (en C++)<\/strong><\/h3>\n\n\n\n<p>El codi, en C++, seria el seg\u00fcent:<\/p>\n\n\n\n<p class=\"has-gray-color has-text-color has-link-color has-small-font-size wp-elements-9b12eac6e2ef893257808d0e4f7135ed\">\/\/ &nbsp; Llibreries incloses<\/p>\n\n\n\n<p class=\"has-highlight-color has-text-color has-link-color has-small-font-size wp-elements-ba5d632f3524b1d89598d713fb876e59\"><strong>#include<\/strong> <strong>&lt;<\/strong>BitbloqUS.h<strong>&gt;<\/strong><\/p>\n\n\n\n<p class=\"has-highlight-color has-text-color has-link-color has-small-font-size wp-elements-9a796ee2fc4ef8e8a7c32baa6a1b9a11\"><strong>#include<\/strong> <strong>&lt;<\/strong>Servo.h<strong>&gt;<\/strong><\/p>\n\n\n\n<p class=\"has-highlight-color has-text-color has-link-color has-small-font-size wp-elements-757812ea92388d3d7c24c99470dd326a\"><strong>#include<\/strong> <strong>&lt;<\/strong>BitbloqSoftwareSerial.h<strong>&gt;<\/strong><\/p>\n\n\n\n<p class=\"has-gray-color has-text-color has-link-color has-small-font-size wp-elements-9a6ccf316928db19230f9f1355e7080b\">\/\/ &nbsp; Variables i funcions<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-a13ec628bbc6b904d55a456464f0ab13\">uint8_t ledL = 13;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-d605dfecd67cec5e5cb80691ccb41735\">uint8_t ledC = 12;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-520b4ba004d73a899e28de913ea90bfb\">uint8_t ledR = 11;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-c59e9b69c642da0ab9acf81d96479d1f\">US ultrasonidosL(7, 7);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-3344d143d6e3884d2100eb967e84efb7\">US ultrasonidosC(6, 6);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-a11ff6567baf7b8ed9292e6c0c33878e\">US ultrasonidosR(5, 5);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-1ffa43926a49347da81383c0803829bd\">Servo servo;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-e502cab5ad23149ba4290def27408190\">bqSoftwareSerial board_bluetooth(0, 1, 115200);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-e2676e1a0c39ad26bf6c426080536b01\"><strong>float<\/strong> distanciaL = 0;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-2f139d38d2a79e1be3ae099d72b1cc57\"><strong>float<\/strong> distanciaC = 0;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-5d3f274a3e72c6710523eeb11ef9aa30\"><strong>float<\/strong> distanciaR = 0;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-0fcbe13a54f0641afd8942bf93692196\"><strong>float<\/strong> angle = 90;<\/p>\n\n\n\n<p class=\"has-gray-color has-text-color has-link-color has-small-font-size wp-elements-9aab32a670c4454482d96d6d40f65ea8\">\/\/ &nbsp; Setup<\/p>\n\n\n\n<p class=\"has-tertiary-color has-text-color has-link-color has-small-font-size wp-elements-c32ced481b092812776bf38f3177ff9b\"><strong>void<\/strong> setup() {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-1ea86dbce9e1f677072f8fc6ab8a813b\">&nbsp;&nbsp;&nbsp;&nbsp;pinMode(ledL, OUTPUT);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-2dc11e2320c5ef896e7718677dd0c46f\">&nbsp;&nbsp;&nbsp;&nbsp;pinMode(ledC, OUTPUT);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-eb42a319d1a54bc491f461274f1f5310\">&nbsp;&nbsp;&nbsp;&nbsp;pinMode(ledR, OUTPUT);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-fd3475232b4ae5b2d6eda7d802a89f8d\">&nbsp;&nbsp;&nbsp;&nbsp;servo.attach(3);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-46fe98a5e25c2aff7308fb3fc3d75543\">&nbsp;&nbsp;&nbsp;&nbsp;board_bluetooth.begin(115200);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-2caf923c59264ca544748efbb042b308\">&nbsp;&nbsp;&nbsp;&nbsp;servo.write(angle);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-74ee224487753629e7763a880eccaced\">&nbsp;&nbsp;&nbsp;&nbsp;board_bluetooth.println(angle);<\/p>\n\n\n\n<p class=\"has-tertiary-color has-text-color has-link-color has-small-font-size wp-elements-51b171dc2000bb64e2a39621d06ecc36\">}<\/p>\n\n\n\n<p class=\"has-gray-color has-text-color has-link-color has-small-font-size wp-elements-49d5bfec9b3b6b0a487a675118a85f33\">\/\/ &nbsp; Loop<\/p>\n\n\n\n<p class=\"has-tertiary-color has-text-color has-link-color has-small-font-size wp-elements-e8b60c0d471377bbbc4ce5035947f921\"><strong>void<\/strong> loop() {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-8265ab1d420f1ba4c6b73120923ebe67\">&nbsp;&nbsp;&nbsp;&nbsp;distanciaL = ultrasonidosL.read();<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-c2a98ec798291cfea09b77baeffa5a68\">&nbsp;&nbsp;&nbsp;&nbsp;distanciaC = ultrasonidosC.read();<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-e39de4d3bade701eb7b7fcdde8858746\">&nbsp;&nbsp;&nbsp;&nbsp;distanciaR = ultrasonidosR.read();<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-69d4a464efd0479ae1653758d88c0d25\">&nbsp;&nbsp;&nbsp;&nbsp;<strong>if<\/strong> (distanciaL == 0) {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-747d073f0522dfc6273eb1a133e80c8a\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;distanciaL = 999;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-30b3a73cff7aed96936914a958de8659\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-410f091fdde1ff53a7b55ff336bd6a51\">&nbsp;&nbsp;&nbsp;&nbsp;<strong>if<\/strong> (distanciaC == 0) {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-42a59292b5b862f94c3c418495e0a7d5\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;distanciaC = 999;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-30b3a73cff7aed96936914a958de8659\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-88031bf11546027965c70cba3f634219\">&nbsp;&nbsp;&nbsp;&nbsp;<strong>if<\/strong> (distanciaR == 0) {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-c13beeb6215266a604f31659b5fe80ad\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;distanciaR = 999;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-30b3a73cff7aed96936914a958de8659\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-717fc1739492f8628c15602cac035d9b\">&nbsp;&nbsp;&nbsp;&nbsp;<strong>if<\/strong> (((distanciaL &lt; distanciaC) &amp;&amp; (distanciaL &lt;= distanciaR))) {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-751443da6af37f4e95e273b3d6d716bb\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;angle = 45;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-6a5be2e7d3178e240c6591ee6a221cc4\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledL, HIGH);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-1fee42b4d0bda1550cdc48bc123f39ea\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledC, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-f9a485615158737a31db7e8467f36073\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledR, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-30b3a73cff7aed96936914a958de8659\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-09fbe5d3aee3faa24735130546e4fa4a\">&nbsp;&nbsp;&nbsp;&nbsp;<strong>else<\/strong> <strong>if<\/strong> (((distanciaC &gt;= distanciaL) &amp;&amp; (distanciaL &lt;= distanciaR))) {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-f2bf068c3f81b4e18e0801c68044ecde\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;angle = 67.5;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-6a5be2e7d3178e240c6591ee6a221cc4\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledL, HIGH);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-b21e0bfd75101cd9cd125cadfe40c17f\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledC, HIGH);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-f9a485615158737a31db7e8467f36073\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledR, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-30b3a73cff7aed96936914a958de8659\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-aa891ab51cb044fcdaf6484d768ca9bb\">&nbsp;&nbsp;&nbsp;&nbsp;<strong>else<\/strong> <strong>if<\/strong> (((distanciaC &gt;= distanciaL) &amp;&amp; (distanciaC &lt;= distanciaR))) {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-838c6f4cd027ff3abdf8988864c586b5\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;angle = 90;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-b21e0bfd75101cd9cd125cadfe40c17f\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledC, HIGH);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-f9a485615158737a31db7e8467f36073\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledR, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-838e9e4257dffd66c7b631a7ca8551e8\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledL, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-30b3a73cff7aed96936914a958de8659\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-2f71c15ff29dad95e52a7c067745fd5d\">&nbsp;&nbsp;&nbsp;&nbsp;<strong>else<\/strong> <strong>if<\/strong> (((distanciaC &gt;= distanciaL) &amp;&amp; (distanciaC &gt; distanciaR))) {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-33b970518cc432fc090a787d454f753e\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;angle = 112.5;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-b21e0bfd75101cd9cd125cadfe40c17f\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledC, HIGH);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-e6d4e4b584ab200a94d3ea7370181f9e\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledR, HIGH);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-838e9e4257dffd66c7b631a7ca8551e8\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledL, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-30b3a73cff7aed96936914a958de8659\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-b1f5aada90966362dbbb66f0447cc5e9\">&nbsp;&nbsp;&nbsp;&nbsp;<strong>else<\/strong> <strong>if<\/strong> (((distanciaL &gt;= distanciaR) &amp;&amp; (distanciaC &gt; distanciaR))) {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-f71a2a693e109b1f4adc83bab0d94624\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;angle = 135;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-e6d4e4b584ab200a94d3ea7370181f9e\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledR, HIGH);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-1fee42b4d0bda1550cdc48bc123f39ea\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledC, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-838e9e4257dffd66c7b631a7ca8551e8\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledL, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-30b3a73cff7aed96936914a958de8659\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-e34edfec86892c8b5b0321d331cddf29\">&nbsp;&nbsp;&nbsp;&nbsp;<strong>else<\/strong> {<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-838c6f4cd027ff3abdf8988864c586b5\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;angle = 90;<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-838e9e4257dffd66c7b631a7ca8551e8\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledL, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-1fee42b4d0bda1550cdc48bc123f39ea\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledC, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-f9a485615158737a31db7e8467f36073\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;digitalWrite(ledR, LOW);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-30b3a73cff7aed96936914a958de8659\">&nbsp;&nbsp;&nbsp;&nbsp;}<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-74ee224487753629e7763a880eccaced\">&nbsp;&nbsp;&nbsp;&nbsp;board_bluetooth.println(angle);<\/p>\n\n\n\n<p class=\"has-link-color has-small-font-size wp-elements-c3a2f1546b6ab61ab29afd1bb576a031\">&nbsp;&nbsp;&nbsp;&nbsp;delay(20);<\/p>\n\n\n\n<p class=\"has-tertiary-color has-text-color has-link-color has-small-font-size wp-elements-51b171dc2000bb64e2a39621d06ecc36\">}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>4.1. Estructura del codi Aquest codi: A la plataforma bitbloq, el codi associat en forma de blocs seria el seg\u00fcent:<\/p>\n","protected":false},"author":6283,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-28931","post","type-post","status-publish","format-standard","hentry","category-blog-retotech"],"_links":{"self":[{"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/posts\/28931"}],"collection":[{"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/users\/6283"}],"replies":[{"embeddable":true,"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/comments?post=28931"}],"version-history":[{"count":4,"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/posts\/28931\/revisions"}],"predecessor-version":[{"id":28985,"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/posts\/28931\/revisions\/28985"}],"wp:attachment":[{"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/media?parent=28931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/categories?post=28931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/retotech.fundacionendesa.org\/multisite\/wp-json\/wp\/v2\/tags?post=28931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}