{"id":63,"date":"2008-09-11T17:08:39","date_gmt":"2008-09-11T21:08:39","guid":{"rendered":"http:\/\/mikelberman.com\/blog\/?p=63"},"modified":"2008-09-11T17:08:39","modified_gmt":"2008-09-11T21:08:39","slug":"digital-io-with-arduino","status":"publish","type":"post","link":"http:\/\/mikelberman.com\/blog\/?p=63","title":{"rendered":"Digital I\/O with Arduino"},"content":{"rendered":"<p><em>PComp &#8211; Lab 1<\/em><\/p>\n<p style=\"text-align: left;\">Finally had the time to check this board out.\u00a0 Having not touched the thing since class a week ago, I stepped in all the bear traps waiting for the new user.\u00a0 It was hilarious, I had no troubles with the breadboard, meanwhile forgetting to install the driver was the first time burner.\u00a0 Then not uploading to the board was the second mistake.\u00a0 Once Aaron &amp; Maria called out my goober, I was good to go, and clicked my LEDs on\/off.<\/p>\n<p style=\"text-align: left;\">The breadboard itself is old hat for me.\u00a0 I must say, this is a bit easier than getting the PIC programmer running.\u00a0 I\u2019ll go ahead and recount anyway.\u00a0 Connecting the 5V to the (+) and GRD to the (-), gave the board power and a place to ground.\u00a0 Popped in an LED (long leg +) across the two leads, and viola, Rudolph.<\/p>\n<p>Getting familiar with electron flow and the pins on the Arduino board, I used the 5V DC from the Arduino to power an LED on a breadboard.<\/p>\n<div id=\"attachment_65\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/mikelberman.com\/blog\/wp-content\/uploads\/switch1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-65\" class=\"size-medium wp-image-65\" title=\"OpenSwitch\" src=\"http:\/\/mikelberman.com\/blog\/wp-content\/uploads\/switch1-300x267.jpg\" alt=\"Open Circuit\" width=\"300\" height=\"267\" \/><\/a><p id=\"caption-attachment-65\" class=\"wp-caption-text\">Open Circuit <\/p><\/div>\n<div id=\"attachment_66\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/mikelberman.com\/blog\/wp-content\/uploads\/switch2.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-66\" class=\"size-medium wp-image-66\" title=\"ClosedSwitch\" src=\"http:\/\/mikelberman.com\/blog\/wp-content\/uploads\/switch2-300x249.jpg\" alt=\"Closed Circuit\" width=\"300\" height=\"249\" \/><\/a><p id=\"caption-attachment-66\" class=\"wp-caption-text\">Closed Circuit<\/p><\/div>\n<p>The next step was to connect a switch to the Arduino, that I would test its state (HIGH or LOW) with my code.\u00a0 If the switch was closed, it would send the 5V back to the Arduino and satisfy a test for HIGH.\u00a0 If the switch were open it would not return any voltage, and be set to LOW.\u00a0 In the code, I set up a conditional that if the switch was closed, light the yellow LED, otherwise, light the red LED.<\/p>\n<p style=\"text-align: left;\">Once I started using HIGH and LOW values in the Arduino program, the voltage came from the digital pin outs, in this case I used 2 for the switch, and 3 and 4 for LEDs, as per the class example.\u00a0 If the switch was pressed, I\u2019d use the function digitalRead(#), # being the pin I\u2019m listening to.\u00a0 Using a conditional statement, I used digitalWrite(#) to switch on LEDS with HIGH or off with LOW.<\/p>\n<p style=\"text-align: left;\">Working in the shop was a lot of fun, albeit super distracting.\u00a0 I think I helped troubleshoot four projects or so before even getting my basic Lab completed.\u00a0 Aaron &amp; Maria were having a lot of fun behind me, working on a way to hook arrange Dominos as 3 or 4 sequence combination lock.\u00a0 The problem they were having was that they were sending separate pins to each domino, but they all had the common ground.\u00a0 I proposed they use the analog in on the Arduino.\u00a0 I searched on the Arduino site that the pin gives a digital value of the analog voltage between 0 and 1023, so I proposed that they should add a different amount of resistence to each domino, take readings and write if-statements correlating to the results.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PComp &#8211; Lab 1 Finally had the time to check this board out.\u00a0 Having not touched the thing since class a week ago, I stepped in all the bear traps waiting for the new user.\u00a0 It was hilarious, I had no troubles with the breadboard, meanwhile forgetting to install the driver was the first time [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-63","post","type-post","status-publish","format-standard","hentry","category-physical-computing"],"_links":{"self":[{"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/63","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=63"}],"version-history":[{"count":10,"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/63\/revisions"}],"predecessor-version":[{"id":76,"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/63\/revisions\/76"}],"wp:attachment":[{"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=63"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=63"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mikelberman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}