
{"id":10985,"date":"2016-06-15T10:59:21","date_gmt":"2016-06-15T08:59:21","guid":{"rendered":"https:\/\/www.brickrknowledge.de\/es\/test-your-reaction\/"},"modified":"2016-06-15T10:59:21","modified_gmt":"2016-06-15T08:59:21","slug":"test-your-reaction","status":"publish","type":"post","link":"https:\/\/forum.brickrknowledge.eu\/es\/test-your-reaction\/","title":{"rendered":"Test your reaction!"},"content":{"rendered":"<p>Reaction test with Arduino and our bricks<\/p>\n<p>We\u2019ll present our reaction game to you today that we did with our bricks and the Arduino Nano. Below, you\u2019ll find the according code and you can watch the <a href=\"https:\/\/www.youtube.com\/watch?v=Db7E93g7a4Y\">YouTube video here<\/a>.<\/p>\n<p>Have fun programming and testing your reaction!<\/p>\n<p>Once you\u2019ve connected the battery you are in the main menu. To get to the first level you need to shortly press the button. The yellow onboard LED will lighten up for a certain amount of time in which you need to keep pressing the button. If you successfully do this, the yellow LED brick will lighten up and you will enter the next level.<\/p>\n<p>The time you have to press the button becomes shorter and shorter. After three failed attempts, that means, when the red LED lightens up, you\u2019ll get back to the main menu. Once you\u2019ve managed the last level, both LEDs will lighten up.<\/p>\n<p>Here is the code for the Arduino:<\/p>\n<p>\/*<\/p>\n<p>Authors:Michael Steidl, Maria Hoffmann<\/p>\n<p>Date: 04.06.2016<\/p>\n<p>Licence: GPL v2<\/p>\n<p>&nbsp;<\/p>\n<p>Reaction game<\/p>\n<p>&nbsp;<\/p>\n<p>*\/<\/p>\n<p>&nbsp;<\/p>\n<p>#define GREENLED 2<\/p>\n<p>#define REDLED 3<\/p>\n<p>#define SWITCH 4<\/p>\n<p>&nbsp;<\/p>\n<p>int GELBELED = 13;<\/p>\n<p>int reactionTime = 500;<\/p>\n<p>int subTime = 50;<\/p>\n<p>int winningTime = 150;<\/p>\n<p>int errors = 0;<\/p>\n<p>boolean game = false;<\/p>\n<p>&nbsp;<\/p>\n<p>void menu();<\/p>\n<p>void ingame();<\/p>\n<p>void resetAllValues();<\/p>\n<p>&nbsp;<\/p>\n<p>void setup()<\/p>\n<p>{<\/p>\n<p>pinMode(GREENLED, OUTPUT);<\/p>\n<p>pinMode(REDLED, OUTPUT);<\/p>\n<p>pinMode(SWITCH, INPUT_PULLUP);<\/p>\n<p>pinMode(GELBELED, OUTPUT);<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>void resetAllValues()<\/p>\n<p>{<\/p>\n<p>int reactionTime = 500;<\/p>\n<p>int subTime = 50;<\/p>\n<p>int winningTime = 150;<\/p>\n<p>int errors = 0;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>void menu()<\/p>\n<p>{<\/p>\n<p>if(digitalRead(SWITCH)==LOW)<\/p>\n<p>{<\/p>\n<p>game = true;<\/p>\n<p>}<\/p>\n<p>digitalWrite(GREENLED, HIGH);<\/p>\n<p>digitalWrite(REDLED, HIGH);<\/p>\n<p>delay(200);<\/p>\n<p>if(digitalRead(SWITCH)==LOW)<\/p>\n<p>{<\/p>\n<p>game = true;<\/p>\n<p>}<\/p>\n<p>digitalWrite(GREENLED, LOW);<\/p>\n<p>digitalWrite(REDLED, LOW);<\/p>\n<p>delay(200);<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>void ingame()<\/p>\n<p>{<\/p>\n<p>delay(3000);<\/p>\n<p>&nbsp;<\/p>\n<p>digitalWrite(GELBELED,HIGH);<\/p>\n<p>delay(reactionTime);<\/p>\n<p>digitalWrite(GELBELED,LOW);<\/p>\n<p>&nbsp;<\/p>\n<p>if(digitalRead(SWITCH)==LOW) \/\/gedr\u00c3\u00bcckt<\/p>\n<p>{<\/p>\n<p>\/\/Decrease Reaction Time<\/p>\n<p>reactionTime = reactionTime &#8211; subTime;<\/p>\n<p>if(reactionTime &lt;= winningTime || reactionTime &lt;= 0)<\/p>\n<p>{<\/p>\n<p>game = false;<\/p>\n<p>resetAllValues();<\/p>\n<p>}<\/p>\n<p>digitalWrite(GREENLED,HIGH);<\/p>\n<p>delay(1500);<\/p>\n<p>digitalWrite(GREENLED,LOW);<\/p>\n<p>}<\/p>\n<p>else<\/p>\n<p>{<\/p>\n<p>errors++;<\/p>\n<p>if(errors &gt;= 3)<\/p>\n<p>{<\/p>\n<p>game = false;<\/p>\n<p>resetAllValues();<\/p>\n<p>}<\/p>\n<p>digitalWrite(REDLED,HIGH);<\/p>\n<p>delay(1500);<\/p>\n<p>digitalWrite(REDLED,LOW);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>void loop()<\/p>\n<p>{<\/p>\n<p>if(game == false)<\/p>\n<p>{<\/p>\n<p>menu();<\/p>\n<p>}<\/p>\n<p>else<\/p>\n<p>{<\/p>\n<p>ingame();<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reaction test with Arduino and our bricks We\u2019ll present our reaction game to you today that we did with our bricks and the Arduino Nano. Below, you\u2019ll find the according code and you can watch the YouTube video here. Have fun programming and testing your reaction! Once you\u2019ve connected the battery you are in the [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":10986,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[577],"tags":[601,586,613,614,615],"class_list":["post-10985","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sin-categorizar","tag-arduino-es","tag-coding-es","tag-nano-es","tag-reaction-es","tag-test-es"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Test your reaction! - Brick&#039;R&#039;knowledge<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Test your reaction! - Brick&#039;R&#039;knowledge\" \/>\n<meta property=\"og:description\" content=\"Reaction test with Arduino and our bricks We\u2019ll present our reaction game to you today that we did with our bricks and the Arduino Nano. Below, you\u2019ll find the according code and you can watch the YouTube video here. Have fun programming and testing your reaction! Once you\u2019ve connected the battery you are in the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/\" \/>\n<meta property=\"og:site_name\" content=\"Brick&#039;R&#039;knowledge\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/BrickRknowledge\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-15T08:59:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wiki.brickrknowledge.de\/content\/uploads\/2016\/06\/reaction-test_Bild.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"3643\" \/>\n\t<meta property=\"og:image:height\" content=\"2056\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Lena Wahlsdorf\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@brickrknowledge\" \/>\n<meta name=\"twitter:site\" content=\"@brickrknowledge\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lena Wahlsdorf\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/\",\"url\":\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/\",\"name\":\"Test your reaction! - Brick&#039;R&#039;knowledge\",\"isPartOf\":{\"@id\":\"https:\/\/brickrknowledge.de\/zh-hans\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/forum.brickrknowledge.eu\/content\/uploads\/2016\/06\/reaction-test_Bild.jpg\",\"datePublished\":\"2016-06-15T08:59:21+00:00\",\"dateModified\":\"2016-06-15T08:59:21+00:00\",\"author\":{\"@id\":\"https:\/\/brickrknowledge.de\/zh-hans\/#\/schema\/person\/8f69a5236cc8657e68d506287d0ae975\"},\"breadcrumb\":{\"@id\":\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#breadcrumb\"},\"inLanguage\":\"es-ES\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es-ES\",\"@id\":\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#primaryimage\",\"url\":\"https:\/\/forum.brickrknowledge.eu\/content\/uploads\/2016\/06\/reaction-test_Bild.jpg\",\"contentUrl\":\"https:\/\/forum.brickrknowledge.eu\/content\/uploads\/2016\/06\/reaction-test_Bild.jpg\",\"width\":3643,\"height\":2056},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/forum.brickrknowledge.eu\/es\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Test your reaction!\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/brickrknowledge.de\/zh-hans\/#website\",\"url\":\"https:\/\/brickrknowledge.de\/zh-hans\/\",\"name\":\"Brick&#039;R&#039;knowledge\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/brickrknowledge.de\/zh-hans\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"es-ES\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/brickrknowledge.de\/zh-hans\/#\/schema\/person\/8f69a5236cc8657e68d506287d0ae975\",\"name\":\"Lena Wahlsdorf\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es-ES\",\"@id\":\"https:\/\/brickrknowledge.de\/zh-hans\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0a15594e9d4b0fc995ab2548da24d794?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0a15594e9d4b0fc995ab2548da24d794?s=96&d=mm&r=g\",\"caption\":\"Lena Wahlsdorf\"},\"url\":\"https:\/\/forum.brickrknowledge.eu\/es\/author\/lena\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Test your reaction! - Brick&#039;R&#039;knowledge","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/","og_locale":"es_ES","og_type":"article","og_title":"Test your reaction! - Brick&#039;R&#039;knowledge","og_description":"Reaction test with Arduino and our bricks We\u2019ll present our reaction game to you today that we did with our bricks and the Arduino Nano. Below, you\u2019ll find the according code and you can watch the YouTube video here. Have fun programming and testing your reaction! Once you\u2019ve connected the battery you are in the [&hellip;]","og_url":"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/","og_site_name":"Brick&#039;R&#039;knowledge","article_publisher":"https:\/\/www.facebook.com\/BrickRknowledge","article_published_time":"2016-06-15T08:59:21+00:00","og_image":[{"width":3643,"height":2056,"url":"https:\/\/wiki.brickrknowledge.de\/content\/uploads\/2016\/06\/reaction-test_Bild.jpg","type":"image\/jpeg"}],"author":"Lena Wahlsdorf","twitter_card":"summary_large_image","twitter_creator":"@brickrknowledge","twitter_site":"@brickrknowledge","twitter_misc":{"Written by":"Lena Wahlsdorf","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/","url":"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/","name":"Test your reaction! - Brick&#039;R&#039;knowledge","isPartOf":{"@id":"https:\/\/brickrknowledge.de\/zh-hans\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#primaryimage"},"image":{"@id":"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#primaryimage"},"thumbnailUrl":"https:\/\/forum.brickrknowledge.eu\/content\/uploads\/2016\/06\/reaction-test_Bild.jpg","datePublished":"2016-06-15T08:59:21+00:00","dateModified":"2016-06-15T08:59:21+00:00","author":{"@id":"https:\/\/brickrknowledge.de\/zh-hans\/#\/schema\/person\/8f69a5236cc8657e68d506287d0ae975"},"breadcrumb":{"@id":"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#breadcrumb"},"inLanguage":"es-ES","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/"]}]},{"@type":"ImageObject","inLanguage":"es-ES","@id":"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#primaryimage","url":"https:\/\/forum.brickrknowledge.eu\/content\/uploads\/2016\/06\/reaction-test_Bild.jpg","contentUrl":"https:\/\/forum.brickrknowledge.eu\/content\/uploads\/2016\/06\/reaction-test_Bild.jpg","width":3643,"height":2056},{"@type":"BreadcrumbList","@id":"https:\/\/wiki.brickrknowledge.de\/es\/test-your-reaction\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/forum.brickrknowledge.eu\/es\/"},{"@type":"ListItem","position":2,"name":"Test your reaction!"}]},{"@type":"WebSite","@id":"https:\/\/brickrknowledge.de\/zh-hans\/#website","url":"https:\/\/brickrknowledge.de\/zh-hans\/","name":"Brick&#039;R&#039;knowledge","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/brickrknowledge.de\/zh-hans\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"es-ES"},{"@type":"Person","@id":"https:\/\/brickrknowledge.de\/zh-hans\/#\/schema\/person\/8f69a5236cc8657e68d506287d0ae975","name":"Lena Wahlsdorf","image":{"@type":"ImageObject","inLanguage":"es-ES","@id":"https:\/\/brickrknowledge.de\/zh-hans\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0a15594e9d4b0fc995ab2548da24d794?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0a15594e9d4b0fc995ab2548da24d794?s=96&d=mm&r=g","caption":"Lena Wahlsdorf"},"url":"https:\/\/forum.brickrknowledge.eu\/es\/author\/lena\/"}]}},"_links":{"self":[{"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/posts\/10985"}],"collection":[{"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/comments?post=10985"}],"version-history":[{"count":0,"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/posts\/10985\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/media\/10986"}],"wp:attachment":[{"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/media?parent=10985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/categories?post=10985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/forum.brickrknowledge.eu\/es\/wp-json\/wp\/v2\/tags?post=10985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}