{"id":404,"date":"2016-09-05T08:07:02","date_gmt":"2016-09-05T08:07:02","guid":{"rendered":"http:\/\/blogs.ischool.berkeley.edu\/i262\/?p=404"},"modified":"2016-09-05T08:10:44","modified_gmt":"2016-09-05T08:10:44","slug":"sing-happy-birthday-with-leds","status":"publish","type":"post","link":"https:\/\/blogs.ischool.berkeley.edu\/i262\/2016\/09\/05\/sing-happy-birthday-with-leds\/","title":{"rendered":"Sing happy birthday with LEDs"},"content":{"rendered":"<p>Description<\/p>\n<p>Learning about blinking LED using Arduino, I wanted to create something that could deliver value\/benefit to an observer. A thought came to my mind: sing a song for him\/her! By varying the tempo, I was able to make the LEDs blink along with the song, Happy Birthday.\u00a0\u00a0One obstacle I found was that the LED bulbs were too bright to a naked eye and, thus, are in need of appropriate\/decorative cover.<\/p>\n<p>&nbsp;<\/p>\n<p>Components<\/p>\n<ul>\n<li>1 Arduino Uno<\/li>\n<li>1 Breadboard<\/li>\n<li>2 LEDs<\/li>\n<li>Jumper wires<\/li>\n<li>1 USB cable<\/li>\n<li>1 220 ohm resistor<\/li>\n<\/ul>\n<p>Code<\/p>\n<p>\/\/ the setup function runs once when you press reset or power the board<br \/>\nvoid setup() {<br \/>\n\/\/ initialize digital pin 13 as an output.<br \/>\npinMode(13, OUTPUT);<br \/>\n}<\/p>\n<p>\/\/ the loop function runs over and over again forever<br \/>\nvoid loop() {<br \/>\ndigitalWrite(13, HIGH); \/\/ <strong>Happy birthday to you<\/strong><br \/>\ndelay(375);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH); \/\/turn the LED on (HIGH is the voltage level)<br \/>\ndelay(125); \/\/ wait for a second<br \/>\ndigitalWrite(13, LOW); \/\/ turn the LED off by making the voltage LOW<br \/>\ndelay(50); \/\/ wait for a second<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(1000);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<\/p>\n<p>digitalWrite(13, HIGH); \/\/ <strong>Happy birthday to you<\/strong><br \/>\ndelay(375);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(125);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(1000);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<\/p>\n<p>digitalWrite(13, HIGH); \/\/ <strong>Happy birthday dear my friend<\/strong><br \/>\ndelay(375);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(125);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<\/p>\n<p>digitalWrite(13, HIGH); \/\/ <strong>Happy birthday to you<\/strong><br \/>\ndelay(375);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(125);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(500);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\ndigitalWrite(13, HIGH);<br \/>\ndelay(1000);<br \/>\ndigitalWrite(13, LOW);<br \/>\ndelay(50);<br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-406\" src=\"http:\/\/blogs.ischool.berkeley.edu\/i262\/files\/2016\/09\/image1-300x225.jpg\" alt=\"image1\" width=\"300\" height=\"225\" srcset=\"https:\/\/blogs.ischool.berkeley.edu\/i262\/files\/2016\/09\/image1-300x225.jpg 300w, https:\/\/blogs.ischool.berkeley.edu\/i262\/files\/2016\/09\/image1-768x576.jpg 768w, https:\/\/blogs.ischool.berkeley.edu\/i262\/files\/2016\/09\/image1-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-407\" src=\"http:\/\/blogs.ischool.berkeley.edu\/i262\/files\/2016\/09\/image2-300x225.jpg\" alt=\"image2\" width=\"300\" height=\"225\" srcset=\"https:\/\/blogs.ischool.berkeley.edu\/i262\/files\/2016\/09\/image2-300x225.jpg 300w, https:\/\/blogs.ischool.berkeley.edu\/i262\/files\/2016\/09\/image2-768x576.jpg 768w, https:\/\/blogs.ischool.berkeley.edu\/i262\/files\/2016\/09\/image2-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description Learning about blinking LED using Arduino, I wanted to create something that could deliver value\/benefit to an observer. A thought came to my mind: sing a song for him\/her! By varying the tempo, I was able to make the &hellip; <a href=\"https:\/\/blogs.ischool.berkeley.edu\/i262\/2016\/09\/05\/sing-happy-birthday-with-leds\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3257,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[60082],"tags":[105,66679,66680],"class_list":["post-404","post","type-post","status-publish","format-standard","hentry","category-lab1","tag-arduino","tag-blink","tag-led"],"_links":{"self":[{"href":"https:\/\/blogs.ischool.berkeley.edu\/i262\/wp-json\/wp\/v2\/posts\/404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ischool.berkeley.edu\/i262\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.ischool.berkeley.edu\/i262\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ischool.berkeley.edu\/i262\/wp-json\/wp\/v2\/users\/3257"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ischool.berkeley.edu\/i262\/wp-json\/wp\/v2\/comments?post=404"}],"version-history":[{"count":0,"href":"https:\/\/blogs.ischool.berkeley.edu\/i262\/wp-json\/wp\/v2\/posts\/404\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.ischool.berkeley.edu\/i262\/wp-json\/wp\/v2\/media?parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ischool.berkeley.edu\/i262\/wp-json\/wp\/v2\/categories?post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ischool.berkeley.edu\/i262\/wp-json\/wp\/v2\/tags?post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}