
{"id":3412,"date":"2018-04-26T12:44:21","date_gmt":"2018-04-26T12:44:21","guid":{"rendered":"http:\/\/dyor.roboticafacil.es\/?p=3412"},"modified":"2018-04-27T11:42:24","modified_gmt":"2018-04-27T11:42:24","slug":"lectura-de-un-potenciometro-en-facilino","status":"publish","type":"post","link":"https:\/\/dyor.webs.upv.es\/en\/lectura-de-un-potenciometro-en-facilino\/","title":{"rendered":"Reading a Potentiometer with Facilino"},"content":{"rendered":"<p>In this post, we show a simple example for reading an analog input with Facilino. The analog input value is mapped into a value between 0 and 100 and this will control the integrated LED of Arduino Nano, based on its value.<\/p>\n<p><!--more--><\/p>\n<p>The aim of this example is to introduce analog input measurements using Facilino. Although this example is based on a potentiometer, most of sensor provide an analog output as their interface with a signal that varies between 0 and 5V, which means that can be read with Arduino when connected to an analog input. Therefore, the concepts learn in this example with the potentiometer can be extrapolated to other devices.<\/p>\n<p>Analog inputs, in Arduino, return a value between 0 and 1023 which corresponds to the voltage (the value 1023 corresponds to 5V). Here, we will map the read value so that the value will be expressed in percentage.<\/p>\n<h3>Circuit<\/h3>\n<p>Here we show the required circuit to follow this example using Arduino Nano. The potentiometer is connected to analog input A0 of Arduino Nano.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3413\" src=\"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/04\/pot_example_bb.png\" alt=\"\" width=\"393\" height=\"333\" srcset=\"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/04\/pot_example_bb.png 393w, https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/04\/pot_example_bb-300x254.png 300w\" sizes=\"auto, (max-width: 393px) 100vw, 393px\" \/><\/p>\n<h3>Facilino<\/h3>\n<p>The aim of Facilino&#8217;s program is to regulate the integrated LED based on the potentiometer value. In this sense, if the value is higher than 80% the LED will be ON, while if it is lower than 20% the LED will be OFF. At intermediate values, the LED will blink with a frequency of 1Hz (500ms ON and 500ms OFF). The value measurements will be shown on the console every 500ms when ON or OFF and every 1000ms when blinking.<\/p>\n<p>Here, you can find the solution of the example:<\/p>\n<p style=\"text-align: center;\"><iframe loading=\"lazy\" src=\"https:\/\/roboticafacil.es\/facilino\/blockly\/example.html?lang=en-GB&amp;proc=ArduinoNano&amp;example=analog_read.bly\" width=\"1000\" height=\"550\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><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><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><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><\/p>","protected":false},"excerpt":{"rendered":"<p>Sorry, this entry is only available in Espa\u00f1ol.<\/p>\n","protected":false},"author":1,"featured_media":3416,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[99],"tags":[104,37,103,102],"class_list":["post-3412","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-facilino-ejemplo","tag-analogica","tag-facilino","tag-lectura","tag-potenciometro"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/04\/pot_example_green.png","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":660,"url":"https:\/\/dyor.webs.upv.es\/en\/arduino-intro\/","url_meta":{"origin":3412,"position":0},"title":"Introduction to Arduino","author":"soporte","date":"Tuesday February 14th, 2017","format":false,"excerpt":"Learn how to use Arduino, selection criteria, handling of basic inpunt and output, connection diagrams and some basic programming examples with Facilino. What is Arduino? It's a open hardware platform with breadboard including ATMEL microcontrollers and a programming environment (Arduino IDE). It has been very successful because all the sketches\u2026","rel":"","context":"In &quot;Arduino&quot;","block_context":{"text":"Arduino","link":"https:\/\/dyor.webs.upv.es\/en\/category\/electronica\/arduino\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/02\/facilino_examples_ldr.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/02\/facilino_examples_ldr.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/02\/facilino_examples_ldr.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1018,"url":"https:\/\/dyor.webs.upv.es\/en\/seguilineas\/","url_meta":{"origin":3412,"position":1},"title":"TCRT5000 Module (linetracker)","author":"soporte","date":"Friday February 24th, 2017","format":false,"excerpt":"Learn how to use the light module (linetracker). DYOR robot uses this module to track lines on the ground using the contrast (between black and white). Working principle, connection diagrams and programming examples with Facilino and Arduino. How does it work? TCRT5000 module emits an infrared light using a fotodiode\u2026","rel":"","context":"In &quot;Arduino&quot;","block_context":{"text":"Arduino","link":"https:\/\/dyor.webs.upv.es\/en\/category\/electronica\/arduino\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/02\/facilino_tcrt5000_monitor.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/02\/facilino_tcrt5000_monitor.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/02\/facilino_tcrt5000_monitor.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/02\/facilino_tcrt5000_monitor.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/02\/facilino_tcrt5000_monitor.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/02\/facilino_tcrt5000_monitor.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":3430,"url":"https:\/\/dyor.webs.upv.es\/en\/lectura-de-una-entrada-digital-pulsador-en-facilino\/","url_meta":{"origin":3412,"position":2},"title":"Digital Input Read (Switch) with Facilino","author":"soporte","date":"Thursday April 26th, 2018","format":false,"excerpt":"In this post, we show how to read a digital input in Facilino. We show three examples using different instructions, but all of them produce the same result. The aim of this post is to show how to read a digital input in Facilino. Facilino has generic purpose instructions to\u2026","rel":"","context":"In &quot;Facilino Ejemplo&quot;","block_context":{"text":"Facilino Ejemplo","link":"https:\/\/dyor.webs.upv.es\/en\/category\/programacion\/facilino\/facilino-ejemplo\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/04\/switch_example_green.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3471,"url":"https:\/\/dyor.webs.upv.es\/en\/detectando-colores-sensor-tcs3200\/","url_meta":{"origin":3412,"position":3},"title":"Detecting Colours with TCS3200 sensor","author":"soporte","date":"Friday April 27th, 2018","format":false,"excerpt":"In this post we show how to detect and classify colours using TCS3200 colour sensor and Facilino. Facilino uses simple instructions to detect colours with the TCS3200 sensor. Internally, the instruction uses a SVM that has been trained to classify colours. These instructions require Facilino's license. The aim is to\u2026","rel":"","context":"In &quot;Facilino Ejemplo&quot;","block_context":{"text":"Facilino Ejemplo","link":"https:\/\/dyor.webs.upv.es\/en\/category\/programacion\/facilino\/facilino-ejemplo\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/04\/tcs3200_example_green_key.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3916,"url":"https:\/\/dyor.webs.upv.es\/en\/instalacion-de-librerias-externas-de-facilino\/","url_meta":{"origin":3412,"position":4},"title":"External library installation in Facilino","author":"soporte","date":"Monday June  4th, 2018","format":false,"excerpt":"Some instructions in Facilino have a dependency on external libraries that must be added to Arduino IDE to compile the code. In this post, we explain the installation process of external libraries of Facilino. Facilino \u2194 Arduino IDE Arduino IDE comes with a set of libraries installed by default, that\u2026","rel":"","context":"In &quot;Facilino&quot;","block_context":{"text":"Facilino","link":"https:\/\/dyor.webs.upv.es\/en\/category\/programacion\/facilino\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/06\/arduino.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/06\/arduino.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/06\/arduino.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/06\/arduino.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1961,"url":"https:\/\/dyor.webs.upv.es\/en\/facilino-control\/","url_meta":{"origin":3412,"position":5},"title":"Tutorial 2: Manejo de bucles en Facilino","author":"soporte","date":"Tuesday May 30th, 2017","format":false,"excerpt":"Aprende a utilizar instrucciones de bucle en Facilino. En esta entrada se explica un sencillo ejemplo en el que el usuario introduce un valor a trav\u00e9s del Monitor de Facilino y Arduino realiza una operaci\u00f3n el n\u00famero de veces especificado (en este caso simplemente haremos parpadear el LED de Arduino).\u2026","rel":"","context":"In &quot;Facilino Tutorial&quot;","block_context":{"text":"Facilino Tutorial","link":"https:\/\/dyor.webs.upv.es\/en\/category\/programacion\/facilino\/facilino-tutorial\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/05\/ejemplo2_11.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/05\/ejemplo2_11.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/05\/ejemplo2_11.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/05\/ejemplo2_11.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts\/3412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/comments?post=3412"}],"version-history":[{"count":5,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts\/3412\/revisions"}],"predecessor-version":[{"id":3454,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts\/3412\/revisions\/3454"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/media\/3416"}],"wp:attachment":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/media?parent=3412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/categories?post=3412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/tags?post=3412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}