
{"id":3885,"date":"2018-05-28T15:21:33","date_gmt":"2018-05-28T15:21:33","guid":{"rendered":"http:\/\/dyor.roboticafacil.es\/?p=3885"},"modified":"2020-06-11T07:15:10","modified_gmt":"2020-06-11T07:15:10","slug":"logica-booleana-facilino","status":"publish","type":"post","link":"https:\/\/dyor.webs.upv.es\/en\/logica-booleana-facilino\/","title":{"rendered":"Boolean logic instructions in Facilino"},"content":{"rendered":"<p>In this post, we explain the use of Boolean logic instructions in Facilino.<\/p>\n<p><!--more--><\/p>\n<h3>What&#8217;s boolean logic?<\/h3>\n<p>Boolean logic is the set of relations between tow binary variables, that is, variables that can only take two possible values: true or false. Binary, a.k.a boolean, variables are very important within the context of digital electronic circuits because they are the basis to understand how digital electronic circuits work and also microcontrollers, microprocessors and programming in general.<\/p>\n<h3>What kind of instructions are available in Facilino<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3888 size-full\" src=\"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/05\/facilino_logic.png\" alt=\"\" width=\"147\" height=\"210\" \/><\/p>\n<h4>Relational operators<\/h4>\n<p>They allow stablishing the relation between to variables (any numeric type but Strings).<\/p>\n<p>They allow us to set relations such as: equal to, non-equal to; lower than; lower or equal than; greater than; greater or equal than.<\/p>\n<p>The result of comparing two numbers in a logic relational operation returns true or false depending on the compared numbers and the operation selected.<\/p>\n<h4>Binary operators<\/h4>\n<p>Facilino allows you to work with Boolean operations using to binary operands as inputs A and B, with values true (T) or false (F). Based on the Boolean operator selected, the resulting output will be different:<\/p>\n<table>\n<tbody>\n<tr>\n<th>Operand A<\/th>\n<th>Operand B<\/th>\n<th>Operation &#8220;AND&#8221;<\/th>\n<th>Operation &#8220;OR&#8221;<\/th>\n<th>Operation &#8220;OR Excl.&#8221;<\/th>\n<th>Operation &#8220;OR Non-Excl.&#8221;<\/th>\n<th>Implication<\/th>\n<\/tr>\n<tr>\n<td>F<\/td>\n<td>F<\/td>\n<td>F<\/td>\n<td>F<\/td>\n<td>F<\/td>\n<td>T<\/td>\n<td>T<\/td>\n<\/tr>\n<tr>\n<td>F<\/td>\n<td>T<\/td>\n<td>F<\/td>\n<td>T<\/td>\n<td>T<\/td>\n<td>F<\/td>\n<td>T<\/td>\n<\/tr>\n<tr>\n<td>T<\/td>\n<td>F<\/td>\n<td>F<\/td>\n<td>T<\/td>\n<td>T<\/td>\n<td>F<\/td>\n<td>F<\/td>\n<\/tr>\n<tr>\n<td>T<\/td>\n<td>T<\/td>\n<td>T<\/td>\n<td>T<\/td>\n<td>F<\/td>\n<td>T<\/td>\n<td>T<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Negation<\/h4>\n<p>Negation allows you to obtain the opposite value of a binary variable, which means that is a variable is true, the negation will return false and vice-versa.<\/p>\n<h4>True\/False Constants<\/h4>\n<p>&#8220;True&#8221; or &#8220;False&#8221; constants can be used in the same ways as any binary variable, with the difference that they always return &#8220;true&#8221; or &#8220;false&#8221;, can&#8217;t be changed.<\/p>\n<h3>Examples<\/h3>\n<h4>Example 1<\/h4>\n<p>In this example, we implement a basic logic operation based on an AND operation between two input values, corresponding to readings of push-buttons connected to digital inputs D2 and D3 of Arduino Nano. If both buttons are pushed, the built-in LED will be ON, otherwise, will be OFF.<\/p>\n<p>&nbsp;<\/p>\n<h4>Example 2<\/h4>\n<p>In this second example, we show how to use relational operators. In particular, we compare a secret number (random) with the one obtained through the console input. If both numbers are equal, then we show a congratulation message, otherwise, we invite the user to try it again.<\/p>","protected":false},"excerpt":{"rendered":"<p>Sorry, this entry is only available in Espa\u00f1ol.<\/p>\n","protected":false},"author":1,"featured_media":3893,"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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[97],"tags":[],"class_list":["post-3885","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-facilino-tutorial"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/dyor.webs.upv.es\/wp-content\/uploads\/2018\/05\/facilino_logic.png","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1961,"url":"https:\/\/dyor.webs.upv.es\/en\/facilino-control\/","url_meta":{"origin":3885,"position":0},"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":[]},{"id":1930,"url":"https:\/\/dyor.webs.upv.es\/en\/facilino-suma-numeros\/","url_meta":{"origin":3885,"position":1},"title":"Tutorial 1: Adding up Two Numbers with Facilino","author":"soporte","date":"Monday May 29th, 2017","format":false,"excerpt":"Learn how to use functions with return, join strings, some basic math operation and show results through the Facilino's console. Example of summing up two numbers. In this post, we will explain how functions work in Facilino through a simple example. We will show, step by step how to use\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\/func_with_return_setup_loop2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/05\/func_with_return_setup_loop2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/05\/func_with_return_setup_loop2.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3859,"url":"https:\/\/dyor.webs.upv.es\/en\/funciones-facilino\/","url_meta":{"origin":3885,"position":2},"title":"Functions and Procedures in Facilino","author":"soporte","date":"Thursday May 24th, 2018","format":false,"excerpt":"In this post, we explain the use of functions and procedures in Facilino. We can find the set of instructions related with functions and procedures within the \"Functions\" category in Facilino. Functions and procedures will allow us to stack a set of instructions that you will be able to call\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\/2018\/05\/facilino_functions_input_type.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2379,"url":"https:\/\/dyor.webs.upv.es\/en\/facilino-myblocks\/","url_meta":{"origin":3885,"position":3},"title":"Introduction to Facilino MyBlocks","author":"soporte","date":"Friday December 15th, 2017","format":false,"excerpt":"In this entry, we introduce the block creation tool of Facilino: Facilino MyBlocks. Facilino MyBlocks is a tool for creating your own blocks with Facilino. The aim of this tool is that is can be used for advanced users that want to implement a feature that is not implemented in\u2026","rel":"","context":"In &quot;Facilino Manual&quot;","block_context":{"text":"Facilino Manual","link":"https:\/\/dyor.webs.upv.es\/en\/category\/programacion\/facilino\/facilino-manual\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/12\/FacilinoMyBlocks.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/12\/FacilinoMyBlocks.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/12\/FacilinoMyBlocks.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/12\/FacilinoMyBlocks.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/12\/FacilinoMyBlocks.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/dyor.webs.upv.es\/wp-content\/uploads\/2017\/12\/FacilinoMyBlocks.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":3885,"position":4},"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":3925,"url":"https:\/\/dyor.webs.upv.es\/en\/instrucciones-para-el-control-de-flujo-en-facilino\/","url_meta":{"origin":3885,"position":5},"title":"Control flow instructions in Facilino","author":"soporte","date":"Tuesday June  5th, 2018","format":false,"excerpt":"In this post, we explain instructions related to the control flow of a program in Facilino. What is the control flow? In microcontrollers, the program flow, that how instructions are executed is usually sequential. This means that instructions are executed in order \"as they appear\". In Facilino, \"sequentially\" is achieved\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\/2018\/06\/inicio_repetir.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts\/3885","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=3885"}],"version-history":[{"count":9,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts\/3885\/revisions"}],"predecessor-version":[{"id":5311,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/posts\/3885\/revisions\/5311"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/media\/3893"}],"wp:attachment":[{"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/media?parent=3885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/categories?post=3885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dyor.webs.upv.es\/en\/wp-json\/wp\/v2\/tags?post=3885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}