{"id":403,"date":"2011-05-17T21:47:09","date_gmt":"2011-05-17T19:47:09","guid":{"rendered":"http:\/\/www.albertopasca.it\/whiletrue\/?p=403"},"modified":"2018-05-25T11:44:27","modified_gmt":"2018-05-25T09:44:27","slug":"arduino-photoresistor-and-mood-lamp","status":"publish","type":"post","link":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/","title":{"rendered":"[Arduino] Photoresistor and Mood Lamp"},"content":{"rendered":"<p>Easy way,<br \/>\nan RGB led with random colors that\u00a0<strong>light on when light is off<\/strong>\u00a0connected to Arduino Uno!<\/p>\n<p><!--more--><\/p>\n<p><center><br \/>\n<iframe loading=\"lazy\" src=\"http:\/\/www.youtube.com\/embed\/eHRr8YKhDAw\" width=\"480\" height=\"390\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\" data-mce-fragment=\"1\"><\/iframe><\/center>Another bullshit!<\/p>\n<p>Color code here:<\/p>\n<p>[code lang=&#8221;cpp&#8221; autolinks=&#8221;false&#8221; collapse=&#8221;false&#8221; firstline=&#8221;1&#8243; gutter=&#8221;true&#8221; htmlscript=&#8221;false&#8221; light=&#8221;false&#8221; padlinenumbers=&#8221;false&#8221; smarttabs=&#8221;true&#8221; tabsize=&#8221;4&#8243; toolbar=&#8221;false&#8221;][&#8230;]<br \/>\nrandomSeed(analogRead(0));<\/p>\n<p>for\u00a0(int\u00a0x=0;\u00a0x&amp;amp;lt;3;\u00a0x++)\u00a0{<br \/>\n  INC[x]\u00a0=\u00a0(RGB1[x]\u00a0&#8211;\u00a0RGB2[x])\u00a0\/\u00a0256;<br \/>\n}<\/p>\n<p>for\u00a0(int\u00a0x=0;\u00a0x&amp;amp;lt;256;\u00a0x++)\u00a0{<br \/>\n  red\u00a0=\u00a0int(RGB1[0]);<br \/>\n  green\u00a0=\u00a0int(RGB1[1]);<br \/>\n  blue\u00a0=\u00a0int(RGB1[2]);<\/p>\n<p>  analogWrite\u00a0(RedPin,\u00a0red);<br \/>\n  analogWrite\u00a0(GreenPin,\u00a0green);<br \/>\n  analogWrite\u00a0(BluePin,\u00a0blue);<br \/>\n  delay(10);<\/p>\n<p>  RGB1[0]\u00a0-=\u00a0INC[0];<br \/>\n  RGB1[1]\u00a0-=\u00a0INC[1];<br \/>\n  RGB1[2]\u00a0-=\u00a0INC[2];<br \/>\n}<\/p>\n<p>for\u00a0(int\u00a0x=0;\u00a0x&amp;amp;lt;3;\u00a0x++)\u00a0{<br \/>\n  RGB2[x]\u00a0=\u00a0random(556)-300;<br \/>\n  RGB2[x]\u00a0=\u00a0constrain(RGB2[x],\u00a00,\u00a0255);<br \/>\n  delay(10);<br \/>\n}<br \/>\n[&#8230;][\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Easy way, an RGB led with random colors that\u00a0light on when light is off\u00a0connected to Arduino Uno!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_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},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[326,260,259,258],"class_list":["post-403","post","type-post","status-publish","format-standard","hentry","category-generic","tag-arudino","tag-lamp","tag-mood","tag-photoresistor"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>[Arduino] Photoresistor and Mood Lamp - while (true) {\u00a0}<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Arduino] Photoresistor and Mood Lamp - while (true) {\u00a0}\" \/>\n<meta property=\"og:description\" content=\"Easy way, an RGB led with random colors that\u00a0light on when light is off\u00a0connected to Arduino Uno!\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/\" \/>\n<meta property=\"og:site_name\" content=\"while (true) {\u00a0}\" \/>\n<meta property=\"article:published_time\" content=\"2011-05-17T19:47:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-05-25T09:44:27+00:00\" \/>\n<meta name=\"author\" content=\"Alberto Pasca\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@lupasca\" \/>\n<meta name=\"twitter:site\" content=\"@lupasca\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alberto Pasca\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/arduino-photoresistor-and-mood-lamp\\\/#article\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/arduino-photoresistor-and-mood-lamp\\\/\"},\"author\":{\"name\":\"Alberto Pasca\",\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\"},\"headline\":\"[Arduino] Photoresistor and Mood Lamp\",\"datePublished\":\"2011-05-17T19:47:09+00:00\",\"dateModified\":\"2018-05-25T09:44:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/arduino-photoresistor-and-mood-lamp\\\/\"},\"wordCount\":122,\"publisher\":{\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\"},\"keywords\":[\"arudino\",\"lamp\",\"mood\",\"photoresistor\"],\"articleSection\":[\"generic\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/arduino-photoresistor-and-mood-lamp\\\/\",\"url\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/arduino-photoresistor-and-mood-lamp\\\/\",\"name\":\"[Arduino] Photoresistor and Mood Lamp - while (true) {\u00a0}\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#website\"},\"datePublished\":\"2011-05-17T19:47:09+00:00\",\"dateModified\":\"2018-05-25T09:44:27+00:00\",\"breadcrumb\":{\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/arduino-photoresistor-and-mood-lamp\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/arduino-photoresistor-and-mood-lamp\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/arduino-photoresistor-and-mood-lamp\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Arduino] Photoresistor and Mood Lamp\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#website\",\"url\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/\",\"name\":\"while (true) {\u00a0}\",\"description\":\"notes from a developer, tutorials, how-to, ideas\",\"publisher\":{\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\\\/\\\/www.albertopasca.it\\\/whiletrue\\\/#\\\/schema\\\/person\\\/d3cf0df774eb4aac797f246a795e9fac\",\"name\":\"Alberto Pasca\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\",\"caption\":\"Alberto Pasca\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g\"},\"description\":\"Software engineer @ Pirelli &amp; C. S.p.A. with a strong passion for mobile \uf8ff development, security, and connected things.\",\"sameAs\":[\"https:\\\/\\\/www.albertopasca.it\",\"albertopasca\",\"https:\\\/\\\/x.com\\\/lupasca\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Arduino] Photoresistor and Mood Lamp - while (true) {\u00a0}","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":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/","og_locale":"en_US","og_type":"article","og_title":"[Arduino] Photoresistor and Mood Lamp - while (true) {\u00a0}","og_description":"Easy way, an RGB led with random colors that\u00a0light on when light is off\u00a0connected to Arduino Uno!","og_url":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/","og_site_name":"while (true) {\u00a0}","article_published_time":"2011-05-17T19:47:09+00:00","article_modified_time":"2018-05-25T09:44:27+00:00","author":"Alberto Pasca","twitter_card":"summary_large_image","twitter_creator":"@lupasca","twitter_site":"@lupasca","twitter_misc":{"Written by":"Alberto Pasca","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/#article","isPartOf":{"@id":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/"},"author":{"name":"Alberto Pasca","@id":"http:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac"},"headline":"[Arduino] Photoresistor and Mood Lamp","datePublished":"2011-05-17T19:47:09+00:00","dateModified":"2018-05-25T09:44:27+00:00","mainEntityOfPage":{"@id":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/"},"wordCount":122,"publisher":{"@id":"http:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac"},"keywords":["arudino","lamp","mood","photoresistor"],"articleSection":["generic"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/","url":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/","name":"[Arduino] Photoresistor and Mood Lamp - while (true) {\u00a0}","isPartOf":{"@id":"http:\/\/www.albertopasca.it\/whiletrue\/#website"},"datePublished":"2011-05-17T19:47:09+00:00","dateModified":"2018-05-25T09:44:27+00:00","breadcrumb":{"@id":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.albertopasca.it\/whiletrue\/arduino-photoresistor-and-mood-lamp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.albertopasca.it\/whiletrue\/"},{"@type":"ListItem","position":2,"name":"[Arduino] Photoresistor and Mood Lamp"}]},{"@type":"WebSite","@id":"http:\/\/www.albertopasca.it\/whiletrue\/#website","url":"http:\/\/www.albertopasca.it\/whiletrue\/","name":"while (true) {\u00a0}","description":"notes from a developer, tutorials, how-to, ideas","publisher":{"@id":"http:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.albertopasca.it\/whiletrue\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"http:\/\/www.albertopasca.it\/whiletrue\/#\/schema\/person\/d3cf0df774eb4aac797f246a795e9fac","name":"Alberto Pasca","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g","caption":"Alberto Pasca"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/4d8fe43c412d0bb34a71c41f60dce53eff3afc027853cbfd20bee6ddc7e93f35?s=96&d=retro&r=g"},"description":"Software engineer @ Pirelli &amp; C. S.p.A. with a strong passion for mobile \uf8ff development, security, and connected things.","sameAs":["https:\/\/www.albertopasca.it","albertopasca","https:\/\/x.com\/lupasca"]}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts\/403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/comments?post=403"}],"version-history":[{"count":3,"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts\/403\/revisions"}],"predecessor-version":[{"id":750,"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/posts\/403\/revisions\/750"}],"wp:attachment":[{"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/media?parent=403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/categories?post=403"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.albertopasca.it\/whiletrue\/wp-json\/wp\/v2\/tags?post=403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}