{"id":10220,"date":"2018-10-23T12:54:51","date_gmt":"2018-10-23T10:54:51","guid":{"rendered":"http:\/\/serveiseducatius.xtec.cat\/tarragones\/?p=10220"},"modified":"2019-01-31T13:57:51","modified_gmt":"2019-01-31T12:57:51","slug":"led-rgb-per-bluetooth","status":"publish","type":"post","link":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/programes\/robotica\/led-rgb-per-bluetooth\/","title":{"rendered":"Led RGB per bluetooth"},"content":{"rendered":"<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/qw8SQgetNPo\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><span style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" data-mce-type=\"bookmark\" class=\"mce_SELRES_start\">\ufeff<\/span><span style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" data-mce-type=\"bookmark\" class=\"mce_SELRES_start\">\ufeff<\/span><span style=\"display: inline-block; width: 0px; overflow: hidden; line-height: 0;\" data-mce-type=\"bookmark\" class=\"mce_SELRES_start\">\ufeff<\/span><\/iframe><\/p>\n<p><b>Material:<\/b><br \/>\n1 tarja Arduino UNO, 1 m\u00f2dul Bluetooth HC-05 o HC-06, 1 breadboard, 1 m\u00f2dul led RGB, 9 cables Dupont, 1 resist\u00e8ncia de 220 Ohm.<\/p>\n<p><b>Descripci\u00f3:<\/b><br \/>\nVariacions de color d&#8217;un m\u00f2dul Led RGB SMD a trav\u00e9s d&#8217;un aplicatiu d&#8217;Android que envia els valors de cada color.<br \/>\nS&#8217;ha utilitzat l&#8217;aplicaci\u00f3 <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=appinventor.ai_yuanryan_chen.BT_LED\" target=\"_blank\" rel=\"noopener\"><strong>Color LED Controller<\/strong> <\/a>(Ryan Chen, Stonez Chen).<br \/>\nAquesta aplicaci\u00f3 envia els valors de cada color RGB separats per punts &#8220;<span style=\"color: #ff0000;\"><strong>.<\/strong><\/span>&#8221; i amb els s\u00edmbol del par\u00e8ntesi &#8220;<span style=\"color: #ff0000;\"><strong>)<\/strong><\/span>&#8221; per indicar el final de codi.<br \/>\nL&#8217;estructura enviada respon a aquesta sintaxi: <strong><span style=\"color: #ff0000;\">R.G.B)<\/span><\/strong><br \/>\nExemple: L&#8217;expressi\u00f3 enviada a trav\u00e9s de bluetooth 125.0.255) significa Vermell (125), Verd (0) i Blau (255)<br \/>\nEl codi generat llegeix byte a byte les dades rebudes pel m\u00f2dul bluetooth i emmagatzema en una variable el valor del color tot convertint els caracters ascii en valors num\u00e8rics. T\u00e9 en compte el canvi de color cada cop que detecta el car\u00e0cter del punt &#8220;<span style=\"color: #ff0000;\"><strong>.<\/strong><\/span>&#8221; i envia els tres valors al m\u00f2dul RGB quan detecta el car\u00e0cter del par\u00e8ntesi &#8220;<span style=\"color: #ff0000;\"><strong>)<\/strong><\/span>&#8221;<br \/>\nEn iniciar el programa la variable &#8220;catode-o-anode&#8221; especifica si el nostre m\u00f2dul RGB \u00e9s d&#8217;\u00c0node Com\u00fa o de C\u00e0tode Com\u00fa. El valor &#8220;1&#8221; indica C\u00e0tode Com\u00fa, qualsevol altra valor indicar\u00e0 \u00c0node Com\u00fa.<\/p>\n<p><b>Esquema:<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10224\" src=\"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-content\/uploads\/usu549\/2018\/10\/robotica_led-RGB-bluetooth_esquema.png\" alt=\"\" width=\"400\" height=\"615\" srcset=\"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-content\/uploads\/usu549\/2018\/10\/robotica_led-RGB-bluetooth_esquema.png 600w, https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-content\/uploads\/usu549\/2018\/10\/robotica_led-RGB-bluetooth_esquema-195x300.png 195w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/p>\n<p><b>Programaci\u00f3 amb ArduinoBlocks:<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10228 alignnone\" src=\"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-content\/uploads\/usu549\/2018\/10\/robotica_led-rgb-bluetooth_arduinoblocks.jpg\" alt=\"\" width=\"800\" height=\"854\" srcset=\"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-content\/uploads\/usu549\/2018\/10\/robotica_led-rgb-bluetooth_arduinoblocks.jpg 800w, https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-content\/uploads\/usu549\/2018\/10\/robotica_led-rgb-bluetooth_arduinoblocks-281x300.jpg 281w, https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-content\/uploads\/usu549\/2018\/10\/robotica_led-rgb-bluetooth_arduinoblocks-768x820.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p><b>Programaci\u00f3 amb Arduino IDE:<\/b><br \/>\n<script src=\"https:\/\/gist.github.com\/xgsxgs\/968f75c813d8e8846cabf01c08bb8d97.js\"><\/script><\/p>\n<p><b>Desc\u00e0rregues:<\/b><\/p>\n<p><a href=\"http:\/\/www.arduinoblocks.com\/web\/project\/41960\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2773 alignleft\" src=\"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-content\/uploads\/usu549\/2018\/03\/boto_descarregues_verd.jpg\" alt=\"Leds en cascada per Arduino IDE\" width=\"200\" height=\"47\" \/><\/a><a href=\"https:\/\/create.arduino.cc\/editor\/xgranell\/6f308506-9d26-4bef-9630-07e135fc9a12\/preview\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-10196 alignleft\" src=\"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-content\/uploads\/usu549\/2016\/12\/boto_descarregues_arduino-create.jpg\" alt=\"\" width=\"200\" height=\"47\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Encendre un led RGB des d\u2019una aplicaci\u00f3 d\u2019Android<\/p>\n","protected":false},"author":1,"featured_media":10238,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[197],"tags":[469,215,221],"class_list":["post-10220","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-robotica","tag-comunicacions","tag-leds","tag-sensors"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/posts\/10220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/comments?post=10220"}],"version-history":[{"count":4,"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/posts\/10220\/revisions"}],"predecessor-version":[{"id":11271,"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/posts\/10220\/revisions\/11271"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/media\/10238"}],"wp:attachment":[{"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/media?parent=10220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/categories?post=10220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serveiseducatius.xtec.cat\/tarragones\/wp-json\/wp\/v2\/tags?post=10220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}