<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-899143671666161628</id><updated>2012-02-01T18:24:33.021-05:00</updated><category term='arduino'/><category term='a fish this big'/><category term='Google Maps'/><category term='HRM'/><category term='worm racing'/><category term='drama'/><category term='processing'/><category term='visualization'/><category term='Grossness'/><category term='Lighting'/><category term='drawing'/><category term='longboarding'/><category term='Springfield VA'/><category term='mylo'/><category term='OpenCV'/><category term='Existential Computing'/><category term='analog'/><category term='sketch'/><category term='self portrait'/><category term='Adam Colton'/><category term='GSV'/><category term='Cottontail'/><category term='worm boarding'/><category term='inverse kinematics'/><category term='Computational Cameras'/><category term='the softness of things'/><category term='Nature of Code'/><category term='LED Tile'/><category term='LEDs'/><category term='computer vision'/><category term='Crafting with Data'/><category term='ICM'/><category term='servo motors'/><category term='Links'/><category term='photocells'/><category term='physical computing'/><category term='serial input'/><category term='blobs'/><category term='conductive circuit'/><category term='Project Studio'/><category term='color tracking'/><category term='Sensor Dome'/><category term='The Rest of You'/><category term='noise'/><title type='text'>iDatoBato Laboratories</title><subtitle type='html'>The work of Matt Richard</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>59</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-2176213974564623232</id><published>2011-10-09T14:09:00.006-04:00</published><updated>2011-10-09T15:11:24.501-04:00</updated><title type='text'>Processing Class 6: 3D and Libraries</title><content type='html'>Hello Class! I hope you all had a great week. Here is a brief of what I want to cover today:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3D in Processing&lt;/div&gt;&lt;div&gt;- How to change the Processing rendering engine to handle 3D graphics: MODE in &lt;a href="http://processing.org/reference/size_.html"&gt;size()&lt;/a&gt;&lt;/div&gt;&lt;div&gt;- Using the 3D Primitives: &lt;a href="http://processing.org/reference/box_.html"&gt;box()&lt;/a&gt; and &lt;a href="http://processing.org/reference/sphere_.html"&gt;sphere()&lt;/a&gt;&lt;/div&gt;&lt;div&gt;- Using &lt;a href="http://processing.org/reference/pushMatrix_.html"&gt;pushMatrix()&lt;/a&gt; and &lt;a href="http://processing.org/reference/popMatrix_.html"&gt;popMatrix()&lt;/a&gt; to adjust placement of 2D shapes in 3D: &lt;a href="http://processing.org/reference/translate_.html"&gt;translate()&lt;/a&gt;, &lt;a href="http://processing.org/reference/rotateX_.html"&gt;rotateX()&lt;/a&gt;, &lt;a href="http://processing.org/reference/rotateY_.html"&gt;rotateY()&lt;/a&gt;, &lt;a href="http://processing.org/reference/rotateZ_.html"&gt;rotateZ()&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Libraries&lt;/div&gt;&lt;div&gt;- What is a library in Processing&lt;/div&gt;&lt;div&gt;- Where to find available libraries and how to find their reference&lt;/div&gt;&lt;div&gt;- How to include a library in a sketch&lt;/div&gt;&lt;div&gt;- How to download and setup a library to work with the Processing application&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:130%;"&gt;3D in Processing&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;While it is important to learn how to draw in Processing using 2D shapes, at some point you are going to want to break into the z-axis. The z-axis represents depth or distance from the user, assuming the user is facing the display. Many of the commands we have been using for 2D shapes such as &lt;a href="http://processing.org/reference/line_.html"&gt;line()&lt;/a&gt; and &lt;a href="http://processing.org/reference/point_.html"&gt;point()&lt;/a&gt; include ways of handling the z-coordinate along with the x and y. Before you can utilize any z-coordinate, you will need to set the render engine in Processing to understand and handle 3D. You set the render engine inside the call to size() inside of setup(). Normally, when sketching in 2D, you only need to use size() to set the width and height of the sketch. When wanting to incorporate 3D, you need to set another 3rd parameter, MODE. The MODE allows you to choose P3D, a Processing based 3D render engine, or OPENGL, a render engine that utilizes calls directly to the graphics card. You will need to look closely at the differences each render engine creates in the look and function of your sketch. Each has a different look and feel and some 2D elements, such as stroke and lines, do not always appear as you might expect.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Lets all take a look at what 3D looks like in Processing by first checking out the examples. Open Examples/3D/Camera and take a look at the 3 sketches inside. These 3 sketches point out how the camera works inside your sketch.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Now open Examples/3D/Image, these sketches show how image data can be used in a 3D environment. Extrusion is especially nice as it moves the position of points based on the brightness of the pixel in the reference image. It is possible to do this with a webcam as well.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Make sure to also take a quick look at the Textures folder and as well as the Transform folder. Rotate1 and Rotate2 examples in Transform show how pushMatrix and popMatrix can be used to create 3D images.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Most of these examples use the P3D render native to the Processing language. However, a few utilize the OPENGL library. Next we are going to learn how to use libraries to add functionality to your sketches.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:130%;"&gt;Libraries&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Simply put, Libraries add things your sketch can do. A library is code that was written to work within Processing, and is specific to a certain task, such as: talking to an Arduino, evaluating sound or creating sound, robust typography control, exotic file type export.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The Processing download includes several libraries which are available upon install. Any other libraries will need to be downloaded and saved into a libraries directory. The libraries directory(folder) needs to be located inside of your sketch folder, the folder where Processing looks to find your sketches(by default it is located in your documents folder). Download the library from the web and place the library folder inside of your libraries folder. Make sure and support Examples files are stored inside the library folder in a folder named "examples".&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;When you want to include a library in your sketch, simply mouse over the "Sketch" drop down menu item at the top of the screen, and select "Import Library…". This will in turn open another drop down menu, listing all of the available libraries. When you click a desired library, a bit of code is added to the top of your sketch on to what ever tab is open. For example, when I choose to include the OpenGL library, the code looks like this:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;import processing.opengl.*;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Now lets take a look at some of the examples included with the libraries included in Processing. &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-2176213974564623232?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/2176213974564623232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/10/processing-class-6-3d-and-libraries.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/2176213974564623232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/2176213974564623232'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/10/processing-class-6-3d-and-libraries.html' title='Processing Class 6: 3D and Libraries'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-1184881756070903706</id><published>2011-10-02T20:21:00.005-04:00</published><updated>2011-10-02T20:29:47.203-04:00</updated><title type='text'>Processing Class 5: Images, Video and Saving</title><content type='html'>Hello Class. This week we are going to revisit nested for loops to move through images and grab data. We are also going to explore how to use video, both local files and a webcam. After we get through that we will learn how to save out versions of our sketches for others to see.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Images:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Processing has a native data type specific to images called PImage. Anytime you want to work with an image you need to use a PImage. The PImage object has multiple properties. Some of them are an array of pixel color value, width, and height. Images that are made up of a grid of pixels are called &lt;a href="http://en.wikipedia.org/wiki/Raster_graphics"&gt;raster graphics&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Video:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Video requires using the video library from processing. We will explore basic use so that we have a better understanding of how to use libraries for next weeks class.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-1184881756070903706?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/1184881756070903706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/10/processing-class-5-images-video-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/1184881756070903706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/1184881756070903706'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/10/processing-class-5-images-video-and.html' title='Processing Class 5: Images, Video and Saving'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-1671417390336971117</id><published>2011-09-25T18:41:00.005-04:00</published><updated>2011-09-25T20:22:39.507-04:00</updated><title type='text'>Class 4: Arrays, Functions and using Images</title><content type='html'>Today's class will cover two very important concepts: Arrays and Functions. Afterwards, I will show you how use images in your sketches.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:130%;"&gt;&lt;a href="http://processing.org/reference/Array.html"&gt;Arrays&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;An array is a list or group of data. You can have an array of any type of data. For example, you want to move 10 rectangles around the screen using random incremental movements between -1 and 1(&lt;a href="http://en.wikipedia.org/wiki/Brownian_motion"&gt;brownian motion&lt;/a&gt;). Instead of creating 10 variables for the x location and 10 for the y location, you can use two arrays, one for the x locations and 1 for the y locations. All of the variables are the same type and their purpose is the same.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Each variable(variables in an array are referred to as elements) in an array is associated with an index number that describes in position in the array. The first element in an array is [0] and the second is [1] and so on. When you create an array you must identify the length or number of elements in the array. You cannot access a value higher than the length of an array. If you try you will receive the Null Pointer error.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Arrays are a little different to create than normal variables. Here are a few ways to create them:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51);  font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;"&gt;&lt;pre  style=" line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;int[] numbers = new int[3];// creates an int array of 3 empty elements&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51);  font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;"&gt;&lt;pre  style=" line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;int[] numbers = {10,20,30};// creates an int array of 3 elements and sets values&lt;/span&gt;&lt;/pre&gt;&lt;pre  style=" line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The power of arrays really comes to life when you use them in combination with for loops. A for loop can increment which element is being accessed/used and you can set the 'test' of the for loop to the length of the array. Every array has a variable that stores its length, the total number of elements. It can be accessed like this, arrayName.length.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51);  font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;"&gt;&lt;pre   style=" line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;font-size:16px;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;int[] numbers = {10,20,30};// creates an int array of 3 elements and sets values&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;for(int i = 0; i &amp;lt; numbers.length; i++){&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;    println(numbers[i]);&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;// prints 10 20 30 each on their own line&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:130%;"&gt;Functions&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Functions are a way of compartmentalizing code. Functions allow you to reuse code without having to copy and paste lines in multiple areas of your code. For example, switching back and forth from a white stroke and black fill to a black stroke and white fill.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51);  font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;"&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;stroke(255);&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;fill(0);&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;// to…&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;stroke(0);&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;fill(255);&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style=" ;font-size:medium;"&gt;Instead of having to copy and paste two lines of code each time, you could write two functions and call those commands in one line of code.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(51, 51, 51);   font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;font-size:16px;"&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;void whiteStrokeBlackFill(){&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;stroke(255);&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;fill(0);&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;// and…&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;void blackStrokeWhiteFill(){&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;stroke(0);&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;fill(255);&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;// to execute the functions…&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51);  font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;"&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;whiteStrokeBlackFill();// turns the stroke to white and the fill to black&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;span class="Apple-style-span"   style=" white-space: pre;  font-family:monospace;font-size:small;"&gt;blackStrokeWhiteFill();// turns the stroke to black and the fill to white&lt;/span&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51);  font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;"&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;();// turns the stroke to white and the fill to black&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;You can increase the usefulness of a function by setting values when you run the function. These values are called parameters. Parameters can be any data type. Here is an example:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; "&gt;&lt;pre  style="font-size: -webkit-xxx-large; line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;void printNumber(int num){&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;println("number = " + num);&lt;/span&gt;&lt;/pre&gt;&lt;pre  style="font-size: -webkit-xxx-large; line-height: normal; color: rgb(0, 0, 0); margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family:'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-1671417390336971117?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/1671417390336971117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/09/class-4-arrays-functions-and-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/1671417390336971117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/1671417390336971117'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/09/class-4-arrays-functions-and-using.html' title='Class 4: Arrays, Functions and using Images'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-3072334828501874649</id><published>2011-09-18T19:41:00.006-04:00</published><updated>2011-09-18T20:31:22.869-04:00</updated><title type='text'>Class 3: For Loops, new Shapes and more Math!!!</title><content type='html'>Hello 3rdWard! I hope you had a great week and are ready of another action packed class of Processing.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Today we are going to be focusing on a very important concept: For Loops.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What is a for loop? A for loop is a way of repeating the same commands a specified number of times.&lt;/div&gt;&lt;div&gt;What does it look like? It looks like this:&lt;/div&gt;&lt;div&gt;&lt;i&gt;for(init; test; update){&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;statements&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;}&lt;/i&gt;&lt;/div&gt;&lt;div&gt;How does a for loop work? The parenthesis setup the structure of a for loop by defining the &lt;i&gt;init&lt;/i&gt;, &lt;i&gt;test&lt;/i&gt;, and &lt;i&gt;update&lt;/i&gt;. The statements inside the block(a block is defined as the arguments inside curly braces{}) run continously as long as the test evaluates as &lt;b&gt;true&lt;/b&gt;. The &lt;i&gt;init&lt;/i&gt; assigns the initial value of the variable used in the &lt;i&gt;test&lt;/i&gt;. The &lt;i&gt;update&lt;/i&gt; is used to modify the variable after each iteration of the block. A for loop works like this:&lt;/div&gt;&lt;div&gt;1. The &lt;i&gt;init&lt;/i&gt; statement is run&lt;/div&gt;&lt;div&gt;2. The &lt;i&gt;test&lt;/i&gt; is evaluated to &lt;b&gt;true&lt;/b&gt; or &lt;b&gt;false&lt;/b&gt;&lt;/div&gt;&lt;div&gt;3. If the &lt;i&gt;test&lt;/i&gt; is &lt;b&gt;true&lt;/b&gt;, continue to step 4. If the &lt;i&gt;test&lt;/i&gt; is &lt;b&gt;false&lt;/b&gt;, jump to step 6&lt;/div&gt;&lt;div&gt;4. Run the &lt;i&gt;statements&lt;/i&gt; within the block&lt;/div&gt;&lt;div&gt;5. Run the &lt;i&gt;update&lt;/i&gt; statement and jump to step 2&lt;/div&gt;&lt;div&gt;6. Exit the structure and continue running the program&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For Loops are very useful in programming graphics as they allow you to make many many iterations very easily.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Shapes:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here are some cheat sheets that will break down the order in which you need to state your vertices to create a shape the way you want to.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/-R_DWXM-mRXo/TnaNRIuu3YI/AAAAAAAAANM/NHqBiY3RarU/s1600/Screen%2Bshot%2B2011-09-18%2Bat%2B8.29.27%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://3.bp.blogspot.com/-R_DWXM-mRXo/TnaNRIuu3YI/AAAAAAAAANM/NHqBiY3RarU/s400/Screen%2Bshot%2B2011-09-18%2Bat%2B8.29.27%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5653861707751021954" style="cursor: pointer; width: 370px; height: 400px; " /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-R8dLOdtRDdI/TnaNQ45Ip5I/AAAAAAAAANE/tLXG3swjuP0/s1600/Screen%2Bshot%2B2011-09-18%2Bat%2B8.28.35%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://4.bp.blogspot.com/-R8dLOdtRDdI/TnaNQ45Ip5I/AAAAAAAAANE/tLXG3swjuP0/s400/Screen%2Bshot%2B2011-09-18%2Bat%2B8.28.35%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5653861703499687826" style="cursor: pointer; width: 315px; height: 400px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-3072334828501874649?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/3072334828501874649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/09/class-3-for-loops-new-shapes-and-more.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3072334828501874649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3072334828501874649'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/09/class-3-for-loops-new-shapes-and-more.html' title='Class 3: For Loops, new Shapes and more Math!!!'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-R_DWXM-mRXo/TnaNRIuu3YI/AAAAAAAAANM/NHqBiY3RarU/s72-c/Screen%2Bshot%2B2011-09-18%2Bat%2B8.29.27%2BPM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-1251776644658036344</id><published>2011-09-11T18:02:00.016-04:00</published><updated>2011-09-11T20:23:13.830-04:00</updated><title type='text'>Processing Class 2: Variables, Math, and Logic</title><content type='html'>Hello everybody. I want to start off this week by taking a look at the awesome &lt;a href="http://www.openprocessing.org/classrooms/?classroomID=907"&gt;self portraits and monsters&lt;/a&gt; you all made. Congratulations, you are officially programmers now :) You successfully created compositions using the shape primitives, changing both the stroke(outline) and fill(shape) colors and mastered the idea of the coordinate system that is in place in Processing. This is not trivial, you have created meaning and subject with math as your tools. The reason I wanted all of you to create an annoyingly tedious character is so you develop an understanding of the coordinate system as well as the way in which order of commands changes composition and a familiarity with the shape building blocks. Next weeks homework will be to add a level of interaction to your monster/self portrait. I will go into this in more detail later….muwahhhahh.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Break down for what you will understand at the end of this class:&lt;/div&gt;&lt;div&gt;You will understand how to setup your sketches to allow for animation and interaction.&lt;/div&gt;&lt;div&gt;You will understand how to create variables, assign values to them and recall those values.&lt;/div&gt;&lt;div&gt;You will understand how to use mathematical operators(+,-,/,*,%, and more) allowing you to use math to arrive at values.&lt;/div&gt;&lt;div&gt;You will understand how to use conditional structures to control the flow of your programs.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As with last week, we are going to take a look at examples that come with Processing. This way you will be able to review when you are home as well as follow along on your machine in class.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:130%;"&gt;Setting up your sketch&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Last week we learned how to create a basic sketch in Processing. These sketches only display one frame that never changes. From now on we are going to be interested in multiple frames, because that way we can create animation and interaction.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Here is how I want you to setup your sketches from now on:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;/*****************************************&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;*  Header Title: elaborate the title here&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;*  more details of sketch here&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;*  include any credits to other people&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;*  Your Name - date when created&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;*****************************************/&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;// declare your variables here&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;// setup() only happens once at the beginning of the sketch&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt;void setup&lt;/span&gt;(){&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt; // this is where you set the initial properties&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt; size&lt;/span&gt;( 400, 400 );&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;// size() should always go inside setup()&lt;/span&gt;&lt;/div&gt;&lt;div  style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt; smooth&lt;/span&gt;();&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;// smooth() usually only needs to go here&lt;/span&gt;&lt;/div&gt;&lt;div size="medium" style=" ;"&gt;}&lt;/div&gt;&lt;div size="medium" style=" ;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div size="medium" style=" ;"&gt;&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;// draw() happens over and over and over&lt;/span&gt;&lt;/div&gt;&lt;div size="medium" style=" ;"&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt;void draw&lt;/span&gt;(){&lt;/div&gt;&lt;div style=" ;font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="color:#ff6600;"&gt; background&lt;/span&gt;(0);&lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;// apply the background first&lt;/span&gt;&lt;/div&gt;&lt;div style=" ;font-size:medium;"&gt; &lt;span class="Apple-style-span"  style="color:#c0c0c0;"&gt;// now draw or evaluate anything you want&lt;/span&gt;&lt;/div&gt;&lt;div style="font-size: medium; "&gt;}&lt;/div&gt;&lt;div style="font-size: medium; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-size: medium; "&gt;* note: blogger lost the rest of lesson so I will be borrowing from Ben and Casey for the short term. I will go back and change this so as to not be directly using there words. But for now...&lt;/div&gt;&lt;div&gt;&lt;div style="font-size: large; "&gt;Data and Variables&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;What is data? Data often consists of measurements of physical characteristics. For example, Casey’s California driver’s license states his sex is M, his hair is BRN, and his eyes are HZL. The values M, BRN, and HZL are items of data associated with Casey. Data can be the population of a country, the average annual rainfall in Los Angeles, or your current heart rate. In software, data is stored as numbers and characters. Examples of digital data include a photograph of a friend stored on your hard drive, a song downloaded from the Internet, and a news article loaded through a web browser. Less obvious is the data continually created and exchanged between computers and other devices. For example, computers are continually receiving data from the mouse and keyboard. When writing a program, you might create a data element to save the location of a shape, to store a color for later use, or to continuously measure changes in cursor position.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Data types&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Processing can store and modify many different kinds of data, including numbers, letters, words, colors, images, fonts, and boolean values (true, false). The computer stores each in a different way, so it has to know which type of data is being used to know how to manage it. For example, storing a word takes more room than storing one letter; therefore, storing the word Cincinnati requires more space than storing the letter C. If space has been allocated for only one letter, trying to store a word in the same space will cause an error. Every data element is represented as sequences of bits (0s and 1s) in the computer’s memory. For example, 01000001 can be interpreted as the letter A, and it can also be interpreted as the number 65. It’s necessary to specify the type of data so the computer knows how to correctly interpret the bits.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Numeric data is the first type of data encountered in the following sections of this book. There are two types of numeric data used in Processing: integer and floating- point. Integers are whole numbers such as 12, -120, 8, and 934. Processing represents integer data with the int data type. Floating-point numbers have a decimal point for creating fractions of whole numbers such as 12.8, -120.75, 8.125, and 934.82736. Processing represents floating-point data with the float data type. Floating-point numbers are often used to approximate analog or continuous values because they have decimal&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;37resolution. For example, using integer values, there is only one number between 3 and 5, but floating-point numbers allow us to express myriad numbers between such as 4.0, 4.5, 4.75, 4.825, etc. Both int and float values may be positive, negative, or zero.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The simplest data element in Processing is a boolean variable. Variables of this type can have only one of two values—true or false. The name boolean refers to the mathematician George Boole (b. 1815), the inventor of Boolean algebra—the foundation for how digital computers work. A boolean variable is often used to make decisions about which lines of code are run and which are ignored.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The following table compares the capacities of the data types mentioned above with other common data types:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Name  &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Size Value &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Range&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;boolean &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;1 bit &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;true or false&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;byte &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;8 bits &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;-128 to 127&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;char &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;16 bits &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;0 to 65535&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;int &lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;32 bits &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;-2,147,483,648 to 2,147,483,647&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;float &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;32 bits &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;3.40282347E+38 to -3.40282347E+38&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;color &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;32 bits &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;16,777,216 colors&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Variables&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;A variable is a container for storing data. Variables allow a data element to be reused many times within a program. Every variable has two parts, a name and a value. If the number 21 is stored in the variable called age, every time the word age appears in the program, it will be replaced with the value 21 when the code is run. In addition to its name and value, every variable has a data type that defines the category of data it can hold.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;A variable must be declared before it is used. A variable declaration states the data type and variable name. The following lines declare variables and then assign values to the variables:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;int x;// Declare the variable x of type int&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;float y;// Declare the variable y of type float&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;boolean b;// Declare the variable b of type boolean&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;x = 50;// Assign the value 50 to x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;y = 12.6;// Assign the value 12.6 to y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;b = true;// Assign the value true to b&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;As a shortcut, a variable can be declared and assigned on the same line:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;int x = 50;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;float y = 12.6;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;boolean b = true;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;More than one variable can be declared in one line, and the variables can then be assigned separately:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;float x, y, z;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;x = -3.9;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;y = 10.1;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;z = 124.23;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;When a variable is declared, it is necessary to state the data type before its name; but after it’s declared, the data type cannot be changed or restated. If the data type is included again for the same variable, the computer will interpret this as an attempt to make a new variable with the same name, and this will cause an error:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;int x = 69; // Assign 69 to x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;x = 70; // Assign 70 to x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;int x = 71; // ERROR! The data type for x is duplicated&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The = symbol is called the assignment operator. It assigns the value from the right side of the = to the variable on its left. Values can be assigned only to variables. Trying to assign a constant to another constant produces an error:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;// Error! The left side of an assignment must be a variable&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;5 = 12;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;When working with variables of different types in the same program, be careful not to mix types in a way that causes an error. For example, it’s not possible to fit a floating- point number into an integer variable:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;// Error! It’s not possible to fit a floating-point number into an int&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;int x = 24.8;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;float f = 12.5;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;// Error! It’s not possible to fit a floating-point number into an int&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;int y = f;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Variables should have names that describe their content. This makes programs easier to read and can reduce the need for verbose commenting. It’s up to the programmer to decide how she will name variables. For example, a variable storing the room temperature could logically have the following names:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;t&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;temp&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;temperature&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;roomTemp&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;roomTemperature&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Processing also includes a few variables that are specific to the sketch. Two we will be using are width and height. Width stores the value of the width of the sketch and height stores the height of the sketch.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Math: Arithmetic&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;In programming, the visual properties of an image on the screen are defined by numbers, which means that the image can be controlled mathematically. For example, a rectangle might have a horizontal position of 10, a vertical position of 10, a width and height of 55, and a gray value of 153. If the gray value is stored in the variable grayVal and 102 is added to this variable, the gray value will become 255 and the shape will appear white on screen.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The +, -, *, /, and = symbols are probably familiar, but the % is more exotic. The % operator calculates the remainder when one number is divided by another. The %, the code notation for modulus, returns the integer remainder after dividing the number to the left of the symbol by the number to the right.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Modulus can be explained with an anecdote. After a hard day of work, Casey and Ben were hungry. They went to a restaurant to eat dumplings, but there were only 9 dumplings left so they had to share. If they share equally, how many dumplings can they each eat and how many will remain? It’s obvious each can have 4 dumplings and 1 will remain. If there are 4 people and 35 dumplings, each can eat 8 and 3 will remain. In these examples, the modulus value is the number of remaining dumplings.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The modulus operator is often used to keep numbers within a desired range. For example, if a variable is continually increasing (0, 1, 2, 3, 4, 5, 6, 7, etc.), applying the modulus operator can transform this sequence. A continually increasing number can be made to cycle continuously between 0 and 3 by applying %4:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;x &lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;0&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;1&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;2&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;3&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;4&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;5&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;6&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;7&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;8&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;9&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;10&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;x%4 &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;0&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;1&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;2&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;3&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;0&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;1&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;2&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;3&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;0&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;1&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;When working with mathematical operators and variables, it’s important to be&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;aware of the data types of the variables you’re using. The combination of two integers will always result in an int. The combination of two floating-point numbers will always result in a float, but when an int and float are operated on, the result is a float.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Integer values can be assigned to floating-point variables, but not vice versa. Assigning a float to an int makes the number less accurate, so Processing requires that you do so explicitly. Working with an int and a float will upgrade the int and treat both numbers as floating-point values, but the result won’t fit into an int variable.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Operator precedence, Grouping&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The order of operations determines which math operators perform their calculations before others. For example, multiplication is always evaluated before addition regardless of the sequence of the elements. The expression 3 + 4 * 5 evaluates to 23 because 4 is first multiplied by 5 to yield 20 and then 3 is added to yield 23. The order of operations specifies that multiplication always precedes addition regardless of the order in which they appear in the expression. The order of operations for evaluating expressions may be changed by adding parentheses. For example, if an addition operation appears in parentheses, it will be performed prior to multiplication. The expression (3 + 4) * 5 evaluates to 35 because 3 is first added to 4 to yield 7, which is then multiplied by 5 to yield 35. This is more concisely expressed in code:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;x = 3 + 4 * 5; // Assign 23 to x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;y = (3 + 4) * 5; // Assign 35 to y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;In many cases, parentheses are necessary to force elements of an expression to evaluate before others, but sometimes they are used only to clarify the order of operations. The following lines calculate the same result because multiplication always happens before addition, but you may find the second line more clear.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;x = 10 * 20 + 5; // Assign 205 to x&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;y = (10 * 20) + 5; // Assign 205 to y&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The following table shows the operator precedence for the operators introduced so far. Items at the top precede those toward the bottom.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Multiplicative&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;* / %&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Additive&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;+ -&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Assignment&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;=&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:130%;"&gt;Decisions and Controlling Flow of Programs&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The programs we’ve seen so far run each line of code in sequence. They run the first line, then the second, then the third, etc. The program stops when the last line is run. It’s often beneficial to change this order—sometimes skipping lines or repeating lines many times to perform a repetitive action. Although the lines of code that comprise a program are always positioned in an order from top to bottom on the page, this doesn’t necessarily define the order in which each line is run. This order is called the flow of the program. Flow can be changed by adding elements of code called control structures.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Relational expressions&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;What is truth? It’s easy to answer this difficult philosophical question in the context of programming because the logical notions of true and false are well defined. Code elements called relational expressions evaluate to true and false. A relational expression is made up of two values that are compared with a relational operator. In Processing, two values can be compared with relational operators as follows:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Expression&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Evaluation&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;3&amp;gt; 5&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;false&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;3&amp;lt; 5&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;true&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;5&amp;lt; 3&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;false&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;5&amp;gt; 3&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;true&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Each of these statements can be converted to English. Using the first row as an example, we can say, “Is three greater than five?” The answer “no” is expressed with the value false. The next row can be converted to “Is three less than five?” The answer is “yes” and is expressed with the value true. A relational expression, two values compared with a relational operator, evaluates to true or false—there are no other possible values. The relational operators are defined as follows:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Operator&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Meaning&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&amp;gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;greater than&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&amp;lt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;less than&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&amp;gt;=&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;greater than or equal to&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&amp;lt;=&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;less than or equal to&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;==&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;equivalent to&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;!=&lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;not equivalent to&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The following lines of code show the results of comparing the same group of numbers with different relational operators:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(3 &amp;gt; 5); // Prints "false"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 &amp;gt; 3); // Prints "true"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 &amp;gt; 5); // Prints "false"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(3 &amp;lt; 5); // Prints "true"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 &amp;lt; 3); // Prints "false"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 &amp;lt; 5); // Prints "false"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(3 &amp;gt;= 5); // Prints "false"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 &amp;gt;= 3); // Prints "true"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 &amp;gt;= 5); // Prints "true"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(3 &amp;lt;= 5); // Prints "true"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 &amp;lt;= 3); // Prints "false"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 &amp;lt;= 5); // Prints "true"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The equality operator, the == symbol, determines whether two values are equivalent. It is different from the = symbol, which assigns a value, but the two are often used erroneously in place of each other. The only way to avoid this mistake is to be careful. It’s similar to using “their” instead of “there” when writing in English—a mistake that even experienced writers sometimes make. The != symbol is the opposite of == and determines whether two values are not equivalent.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(3 == 5); // Prints "false"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 == 3); // Prints "false"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 == 5); // Prints "true"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(3 != 5); // Prints "true"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 != 3); // Prints "true"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;println(5 != 5); // Prints "false"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Conditionals&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Conditionals allow a program to make decisions about which lines of code run and which do not. They let actions take place only when a specific condition is met. Conditionals allow a program to behave differently depending on the values of their variables. For example, the program may draw a line or an ellipse depending on the value of a variable. The if structure is used in Processing to make these decisions:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;if (test) { statements&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The test must be an expression that resolves to true or false. When the test expression evaluates to true, the code inside the { (left brace) and } (right brace) is run. If the expression is false, the code is ignored. Code inside a set of braces is called a block.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Logical operators&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Logical operators are used to combine two or more relational expressions and to invert logical values. They allow for more than one condition to be considered simultaneously. The logical operators are symbols for the logical concepts of AND, OR, and NOT:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Operator&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Meaning&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&amp;amp;&amp;amp;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;AND&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;||&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;OR&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;!&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;NOT&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;The following table outlines all possible combinations and the results.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;Expression&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Evaluation&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;true &amp;amp;&amp;amp; true&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;true&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;true &amp;amp;&amp;amp; false&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;false&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;false &amp;amp;&amp;amp; false&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;false&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;true || true&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;true&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;true || false&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;true&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;false || false&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;false&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;!true&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;false&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:100%;"&gt;!false&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;true&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-1251776644658036344?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/1251776644658036344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/09/processing-class-2-variables-math-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/1251776644658036344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/1251776644658036344'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/09/processing-class-2-variables-math-and.html' title='Processing Class 2: Variables, Math, and Logic'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-485574241766588723</id><published>2011-09-04T20:07:00.002-04:00</published><updated>2011-09-04T20:30:53.567-04:00</updated><title type='text'>Processing Class 1: Hello World!</title><content type='html'>Let me start off by saying I am super excited to teach you all Processing.  I have been wanting to teach Processing to a group for awhile now and I am finally getting the chance. That said, lets get to it.&lt;br /&gt;&lt;br /&gt;Getting Started:&lt;br /&gt;What is Processing? Processing is an environment for programming graphics that was designed to be friendly to non programmers, yet still offer power to advanced users. It was originally created by Ben Fry and Casey Reas but has been contributed to by hundreds of users world wide. Under the hood, Processing is based on Java and any Java code can be implemented along with Processing code. In fact, Processing handles wrapping a ton of Java to make it super easy for you to get up and running without a lot of hassle. For this reason Processing files are called sketches, to relay the ideology of a quick coding attempt at a problem or idea. Don't let the term sketch fool you, a Processing sketch can be a full fledged application written in thousands of lines of code, but it can also only be one line.&lt;br /&gt;&lt;br /&gt;What are we going to cover today:&lt;br /&gt;Get to know the &lt;a href="http://processing.org"&gt;Processing&lt;/a&gt; Website and all it has to offer.&lt;br /&gt;&lt;br /&gt;After we review the website we will get to know the Processing development environment. This is where you will create your Processing sketches.&lt;br /&gt;&lt;br /&gt;Then we will get our hands wet with Processing by going over the examples that are included in Processing. The examples can be found in Examples/Books/Processing Handbook/Units00-17/. For this class we will be covering chapters 01 Structure and 02 Shape 1. I highly recommend the book that goes along with these examples, &lt;a href="http://www.amazon.com/Processing-Programming-Handbook-Designers-Artists/dp/0262182629"&gt;Processing: A Programming Handbook for Visual Designers and Artists&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For homework, please post at least one sketch to the class group on &lt;a href="http://openprocessing.org"&gt;OpenProcessing.org&lt;/a&gt;. The requirements are to make a self portrait or a monster. Here is the &lt;a href="http://openprocessing.org/classrooms/?classroomID=907"&gt;class group&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-485574241766588723?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/485574241766588723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/09/processing-class-1-hello-world.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/485574241766588723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/485574241766588723'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/09/processing-class-1-hello-world.html' title='Processing Class 1: Hello World!'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-5186060285998607680</id><published>2011-04-02T01:31:00.018-04:00</published><updated>2011-07-30T16:07:41.617-04:00</updated><title type='text'>Final Class: Arduino and Physical Computing</title><content type='html'>Hello class! Time sure has flown by, much like how fast this class will go by with all of the cool things we are going to learn today.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is a brief break down of the things to do:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Review array code from last week and discuss in depth what arrays are and how they are to be used.&lt;/li&gt;&lt;li&gt;Learn how to solder.&lt;/li&gt;&lt;li&gt;Use your body as a sensor to control a group of LEDs.&lt;/li&gt;&lt;li&gt;Use a potentiometer attached to the Arduino to adjust the speed of a movie playing in Processing.&lt;/li&gt;&lt;li&gt;Control a drawing program with values sent from Arduino.&lt;/li&gt;&lt;/ol&gt;Let us start by reviewing Arrays from last week.&lt;/div&gt;&lt;div&gt;&lt;div&gt;Arrays and For Loops:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://arduino.cc/en/Reference/Array"&gt;Arrays&lt;/a&gt; are a way of declaring multiple of the same type of variable in a row in memory. Usually they are used with the idea that the values are multiples of the same type of object. What I mean is while the value of the photocell is an integer it doesn't make sense to include it in an array of integers that represent the digital pins used to power LEDs. Arrays are declared a little differently then other variables. Here are a few ways to declare an array:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;int myInts[6];// this creates an array that has 6 places but does not define what the values are&lt;/div&gt;&lt;div&gt;int myPins[] = {2, 4, 8, 3, 6};// this creates an array of 5 places and defines the values&lt;/div&gt;&lt;div&gt;int mySensVals[6] = {2, 4, -8, 3, 2};// this creates an array of 6 places but only defines the first 5 values&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is how you access the values that are store in the arrays above:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;myPins[0], where the value would equal 2.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The number inside of the square brackets [ ] indicates which element to access. Arrays are 0 based, meaning the first element is considered the 0 place not the 1st place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is how you change the value of an element of an array:&lt;/div&gt;&lt;div&gt;myPins[1] = 9;// now the values for myPins look like this: {2, 9, 8, 3, 6}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The real power of arrays is unleashed when combined with &lt;a href="http://arduino.cc/en/Reference/For"&gt;for loops&lt;/a&gt;. The structure of a for loop is a little confusing at first, but once you understand how to use them they are essential. Basically a for loop is a way of repeating a command a determined number of times. You can use an array to count from any number by any number to any number. This makes it perfect for working with arrays because instead of manually putting 0-4 inside of the [ ] to access the values of myPins array, you can use a variable.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is a for loop that prints the values of myPins array to the serial monitor:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;for(int i = 0; i &amp;lt; 5; i++){&lt;div&gt;Serial.print(myPins[i]);&lt;/div&gt;&lt;div&gt;Serial.print(", ");&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;Serial.println();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This snippet of code will display the values with a comma and space between each value and then a line break after the last element has been printed. I recommend that you take a look at the for loop link above. The guys at Arduino have a wonderful description of how the mechanics work.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Soldering:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Soldering is simple in concept but takes some practice to become proficient. Before you begin soldering you will first need the necessary tools: &lt;a href="http://www.radioshack.com/product/index.jsp?productId=2062728"&gt;soldering iron&lt;/a&gt;, &lt;/span&gt;&lt;a href="http://www.sparkfun.com/products/10241"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;solder&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; and a &lt;a href="http://www.allproducts.com/manufacture98/fima/product3.jpg"&gt;copper scrubber&lt;/a&gt;. Some additional tools to mention are: &lt;a href="http://www.radioshack.com/product/index.jsp?productId=2049774"&gt;solder flux&lt;/a&gt;, &lt;a href="http://www.radioshack.com/product/index.jsp?productId=3928375"&gt;helping hands&lt;/a&gt;, and a &lt;a href="http://www.radioshack.com/product/index.jsp?productId=2062745"&gt;solder vacuum&lt;/a&gt;. Out of all of the tools, having great solder and a nice clean tip on your iron will be the biggest help.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Soldering breaks down to a few simple steps. First, apply a beat of solder to the tip of a hot iron. This is called tinning the tip and will allow for easier transfer of heat between the tip and the metals to be soldered together. Next, apply the tip to the contacts(metal part of the component/wire to be soldered) and allow the metals to heat for a second or three. Now place the solder onto the contacts and wait for the solder to flow onto the metal. If done properly the solder will hug close to the contacts, you will know when it happens and it is spectacular. It took me a few hours of soldering to really get the hang of the it.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;By far the most difficult part of soldering is juggling all of the components and tools. Two ways to help with this problem are to use a breadboard to hold the components or use helping hands. Using the breadboard is perfect for soldering &lt;a href="http://www.adafruit.com/index.php?main_page=product_info&amp;amp;cPath=42&amp;amp;products_id=264"&gt;breakout boards&lt;/a&gt;, boards made to have a component interface with a breadboard, but not as good as helping hands at most other soldering applications. One trick my friend &lt;a href="http://www.fridgebuzzz.com/"&gt;Paul Rothman&lt;/a&gt; taught me was to use the helping hands to hold the solder instead of holding the components. This works if you can easily hold both components with one hand and the iron with the other.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;There are tons of tutorials online that show you detailed examples of all types of soldering. I have embedded a great beginner video for reference.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;object height="385" width="480"&gt;&lt;param name="movie" value="http://www.youtube.com/v/BLfXXRfRIzY?fs=1&amp;amp;hl=en_US"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/BLfXXRfRIzY?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="385" width="480"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;So now that we understand how to solder, we are going to give it a try. We want to solder two separate wires to two separate shiny pennies. We will then use the pennies to measure the conductivity of our skin, but only after they have cooled :)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now lets use a similar circuit to the one we used last week with all of our LEDs. Make the circuit in the diagram.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/-w5VMVKiA3eA/TZdVDOnFjAI/AAAAAAAAAMA/CDDIPr4Y1Qw/s1600/gsrAndLEDs.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://3.bp.blogspot.com/-w5VMVKiA3eA/TZdVDOnFjAI/AAAAAAAAAMA/CDDIPr4Y1Qw/s400/gsrAndLEDs.jpg" alt="" id="BLOGGER_PHOTO_ID_5591030976353766402" style="cursor: pointer; width: 325px; height: 400px;" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So far we have been adjusting the values of the min and max for calibrating using the serial window to manually monitor for the lowest and highest values. This time we are going to use an example sketch to have the Arduino do the calibration for us. Open the calibration sketch, it can be found inside of /Examples/Analog/Calibration. ( or copy and paste the code below )&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;&lt;div&gt;/&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  Calibration&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; Demonstrates one technique for calibrating sensor input.  The&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; sensor readings during the first five seconds of the sketch&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; execution define the minimum and maximum of expected values&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; attached to the sensor pin.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; The sensor minimum and maximum initial values may seem backwards.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; Initially, you set the minimum high and listen for anything &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; lower, saving it as the new minimum. Likewise, you set the&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; maximum low and listen for anything higher as the new maximum.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; The circuit:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * Analog sensor (potentiometer will do) attached to analog input 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * LED attached from digital pin 9 to ground&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; created 29 Oct 2008&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; By David A Mellis&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; Modified 4 Sep 2010&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; By Tom Igoe&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; http://arduino.cc/en/Tutorial/Calibration&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; This example code is in the public domain.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;// These constants won't change:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;const int sensorPin = A0;    // pin that the sensor is attached to&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;const int ledPin = 9;        // pin that the LED is attached to&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;// variables:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int sensorValue = 0;         // the sensor value&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int sensorMin = 1023;        // minimum sensor value&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int sensorMax = 0;           // maximum sensor value&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // turn on LED to signal the start of the calibration period:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  pinMode(13, OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  digitalWrite(13, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // calibrate during the first five seconds &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  while (millis() &amp;lt; 5000) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    sensorValue = analogRead(sensorPin);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    // record the maximum sensor value&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    if (sensorValue &amp;gt; sensorMax) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;      sensorMax = sensorValue;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    // record the minimum sensor value&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    if (sensorValue &amp;lt; sensorMin) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;      sensorMin = sensorValue;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // signal the end of the calibration period&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  digitalWrite(13, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // read the sensor:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  sensorValue = analogRead(sensorPin);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // apply the calibration to the sensor reading&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 255);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // in case the sensor value is outside the range seen during calibration&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  sensorValue = constrain(sensorValue, 0, 255);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // fade the LED using the calibrated value:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  analogWrite(ledPin, sensorValue);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;When you upload the code you will notice that only the LED attached to pin 9 seems to light up. To make all of the LEDs work similar to last weeks photo resistor circuit copy and paste the following code.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;Using an array of digital pins and a for loop to easily contol LEDs&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; with a mapped value from a photocell&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; As you can see, using arrays and for loops makes your code a lot smaller&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; and easy to change.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; Matt Richard&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; http://idblab.blogspot.com&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int sensorPin = A0;    // select the input pin for the potentiometer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int ledPins[] = {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  2, 3, 4, 5, 6, 7, 8, 9, 10, 11};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int sensorValue = 0;  // variable to store the value coming from the sensor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int minThresh = 1023;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int maxThresh = 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  Serial.begin(9600);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  for(int i = 0; i &amp;lt; 10; i++){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    pinMode(ledPins[i], OUTPUT); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // turn on LED to signal the start of the calibration period:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  pinMode(13, OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  digitalWrite(13, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // calibrate during the first five seconds &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  while (millis() &amp;lt; 5000) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    sensorValue = analogRead(sensorPin);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    // record the maximum sensor value&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    if (sensorValue &amp;gt; maxThresh) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;      maxThresh = sensorValue;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    // record the minimum sensor value&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    if (sensorValue &amp;lt; minThresh) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;      minThresh = sensorValue;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // signal the end of the calibration period&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  digitalWrite(13, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // read the value from the sensor:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  sensorValue = analogRead(sensorPin);    &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  Serial.println(sensorValue);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  controlLEDs();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void controlLEDs(){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  int numLEDsOn = map(sensorValue, minThresh, maxThresh, 0, 10);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  for(int i = 0; i &amp;lt; numLEDsOn; i++){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    digitalWrite(ledPins[i], HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  for(int j = numLEDsOn; j &amp;lt; 10; j++){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    digitalWrite(ledPins[j], LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Using Arduino and Processing together:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First off, what is &lt;a href="http://www.proessing.org/"&gt;Processing&lt;/a&gt;? From the processing website:&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;blockquote&gt;Processing is a programming language, development environment, and online community that since 2001 has promoted software literacy within the visual arts. Initially created to serve as a software sketchbook and to teach fundamentals of computer programming within a visual context, Processing quickly developed into a tool for creating finished professional work as well.&lt;/blockquote&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;As a programming language, Processing is built from Java and has a strong visual output capability. When we open up the Processing IDE you will notice a strong resemblance to the Arduino IDE. This is because they were meant to work together and the founders of both languages worked together to make them look and work similar. The similarities are greater than skin deep, with Processing having a huge community following offering up tons of &lt;a href="http://www.openprocessing.org/"&gt;code resources&lt;/a&gt;.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are a few ways to work with Arduino and Processing, but I am going to demonstrate only one way today. If you are interested you can check out the &lt;a href="http://www.arduino.cc/playground/Interfacing/Processing"&gt;Arduino library&lt;/a&gt; available in Processing. The library allows you to make Arduino calls directly from Processing.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Today we are going to send a byte through serial to Processing and use that value to adjust the speed of a looping movie. Let's start off by making a simple circuit with the Arduino using a potentiometer and 2 different colored LEDs. The potentiometer will give us a value and the LEDs will give us an idea of what that value is before it gets to Processing. Go ahead and make the circuit in the following image. In your ladyada kit you have 3 clear LEDs, one red, one green, and pen blue. The diagram shows 2 clear LEDs wired to different PWM pins, any 2 of the clear will do because we know they will different. This is to help differentiate between when the video will be playing forwards and backwards.&lt;/div&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/-7-54cAAw5RE/TZbOMv-uuVI/AAAAAAAAAL4/v14xF62-ETw/s1600/potAndLEDsforP5.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://1.bp.blogspot.com/-7-54cAAw5RE/TZbOMv-uuVI/AAAAAAAAAL4/v14xF62-ETw/s400/potAndLEDsforP5.jpg" alt="" id="BLOGGER_PHOTO_ID_5590882705860376914" style="cursor: pointer; width: 400px; height: 338px;" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now lets throw the following code into Arduino and upload it to your board.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;/**&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * Send a byte through Serial to be used by Processing&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * I am pretty sure the original code was written by Tom Igoe&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int analogPin = 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int analogValue = 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int forwardLedPin = 3;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int backwardLedPin = 11;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;int pwmValue = 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void setup()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // start serial port at 9600 bps:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  Serial.begin(9600);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void loop()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // read analog input, divide by 4 to make the range 0-255:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  analogValue = analogRead(analogPin);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  analogValue = analogValue / 4;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  Serial.print(analogValue, BYTE);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // figure out which LED should be on&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // if the values are between 0-127, then the backwardLed should be lit&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  if(analogValue &amp;lt;= 127){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    pwmValue = map(analogValue, 127, 0, 0, 255);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    analogWrite(backwardLedPin, pwmValue);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    analogWrite(forwardLedPin, 0);&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color: rgb(255, 153, 102);font-size:small;"&gt;// this will make sure the other LED is off&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // if the values are between 128-255, then the forwardLed should be lit&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // pwm an led to show that the pot is working&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  if(analogValue &amp;gt;= 128){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    pwmValue = map(analogValue, 128, 255, 0, 255);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    analogWrite(forwardLedPin, pwmValue);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    analogWrite(backwardLedPin, 0);// this will make sure the other LED is off&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // pause for 10 milliseconds:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  delay(10);                 &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;The code maps the value of your potentiometer to light up one LED with one half of the values and light tup the other with the other half of values. The center position of the potentiometer will render both LEDs off. These results mimic how the Processing will react to the values of the potentiometer.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Lets open up Processing and load the loop example for the video library. You can find the sketch by looking in the following folders /Examples/Library/Video(movie)/Loop. Now press the play button in the upper left of the Processing IDE. You will see a transparent video playing and leaving trails where ever your mouse is. This is neat but not what we are after. Go ahead and paste the code I have below into Processing replacing all of the code for the Loop sketch.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;/**&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * Loop Video with values sent from Arduino. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * Using an Arduino and Potentiometer, contro the playback speed of a video &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * Recieve values using Serial I/O library&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;import processing.video.*;// import video library&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;import processing.serial.*;// import serial library&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;Movie myMovie;              // The movie object&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;float timeJump = 0.0;      // amount of time that is displaced when scrubbing the movie in reverse&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;float timePrevious = 0.0;  // the last position of the playhead&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;float timeFuture = 0.0;    // the future position of the playhead&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;float videoSpeed = 0.0;    // the speed at which the video plays&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;float maxSpeed = 5.0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;float minSpeed = -5.0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;Serial myPort;        // The serial port&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  size(640, 480, P2D);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  background(0);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // Load and play the video in a loop&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  myMovie = new Movie(this, "station.mov");&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  myMovie.loop();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  println(Serial.list());&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  myPort = new Serial(this, Serial.list()[0], 9600);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void movieEvent(Movie myMovie) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  myMovie.read();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void draw() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; // tint(255, 30);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  if(videoSpeed &amp;lt; 0) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    timeJump = myMovie.time() - timePrevious;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    timeFuture = myMovie.time() + timeJump;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    if(timeFuture &amp;lt;= 0) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;      // we only need to ajust the playhead if the playhead goes past&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;      // the beginning of the movie in reverse&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;      float newBackwardsTime = myMovie.duration() + timeFuture;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;      myMovie.jump(newBackwardsTime);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  myMovie.speed(videoSpeed);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  image(myMovie, 0, 0, width, height);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  timePrevious = myMovie.time();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;/**&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * serialEvent &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * This function access the values coming in from the serial port &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * It assigns the values to the play speed of the video, called videoSpeed&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * The videoSpeed has a range of -5x to +5x normal playing speed&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * These values are determined by the minSpeed and maxSpeed variables&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * If you alter them you can change the range of speed the video will play&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; * For this to work, an Arduino must be sending one byte through the serial port&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void serialEvent (Serial myPort) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  // get the byte:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  int inByte = myPort.read();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;   videoSpeed = map(inByte, 0, 255, minSpeed, maxSpeed);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    // print it:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  println(inByte);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;// This can be tested with using the keys if you are unable to access and Arduino and potentiometer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;// The UP key increases the speed and the DOWN key decreases the speed&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;void keyPressed() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  if(keyCode == UP) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    videoSpeed += 0.1;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    videoSpeed = constrain(videoSpeed, minSpeed, maxSpeed);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  if(keyCode == DOWN) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    videoSpeed -= 0.1;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;    videoSpeed = constrain(videoSpeed, minSpeed, maxSpeed);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;  println("adjusted videoSpeed with keys to: " + videoSpeed);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102);"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;Now with the Arduino plugged into the usb slot, go ahead and press the play button in Processing. You will notice that when you change the potentiometer, the speed at which the movie is playing will change. It is a lot of fun to manipulate computer programs with physical objects!&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 153, 102);font-size:85%;"&gt;&lt;br /&gt;/**&lt;br /&gt;* Loop Video with values sent from Arduino.&lt;br /&gt;*&lt;br /&gt;* Using an Arduino and Potentiometer, contro the playback speed of a video&lt;br /&gt;* Recieve values using Serial I/O library&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;import processing.serial.*;// import serial library&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;float diameter = 0.0; // the speed at which the video plays&lt;br /&gt;float maxSpeed = 200.0;&lt;br /&gt;float minSpeed = 1.0;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Serial myPort; // The serial port&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;size(600, 600);&lt;br /&gt;background(0);&lt;br /&gt;println(Serial.list());&lt;br /&gt;myPort = new Serial(this, Serial.list()[0], 9600);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void draw() {&lt;br /&gt;&lt;br /&gt;ellipse(mouseX, mouseY, diameter, diameter);&lt;br /&gt;}&lt;br /&gt;/**&lt;br /&gt;* serialEvent&lt;br /&gt;*&lt;br /&gt;* This function access the values coming in from the serial port&lt;br /&gt;* It assigns the values to the play speed of the video, called videoSpeed&lt;br /&gt;* The videoSpeed has a range of -5x to +5x normal playing speed&lt;br /&gt;* These values are determined by the minSpeed and maxSpeed variables&lt;br /&gt;* If you alter them you can change the range of speed the video will play&lt;br /&gt;* For this to work, an Arduino must be sending one byte through the serial port&lt;br /&gt;*/&lt;br /&gt;void serialEvent (Serial myPort) {&lt;br /&gt;// get the byte:&lt;br /&gt;int inByte = myPort.read();&lt;br /&gt;diameter = map(inByte, 0, 255, minSpeed, maxSpeed);&lt;br /&gt;// print it:&lt;br /&gt;println(inByte);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// This can be tested with using the keys if you are unable to access and Arduino and potentiometer&lt;br /&gt;// The UP key increases the speed and the DOWN key decreases the speed&lt;br /&gt;void keyPressed() {&lt;br /&gt;if(keyCode == UP) {&lt;br /&gt;  diameter += 0.1;&lt;br /&gt;  diameter = constrain(diameter, minSpeed, maxSpeed);&lt;br /&gt;}&lt;br /&gt;if(keyCode == DOWN) {&lt;br /&gt;  diameter -= 0.1;&lt;br /&gt;  diameter = constrain(diameter, minSpeed, maxSpeed);&lt;br /&gt;}&lt;br /&gt;println("adjusted diameter with keys to: " + diameter);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 153, 102);font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Here we are able to adjust a sketch created by Dan Shiffman to allow interaction with a webcam and the arduino. We are also saving out a .mov file when you press spacebar.&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;blockquote&gt;/**&lt;/blockquote&gt;&lt;blockquote&gt; * Mirror &lt;/blockquote&gt;&lt;blockquote&gt; * by Daniel Shiffman.  &lt;/blockquote&gt;&lt;blockquote&gt; * &lt;/blockquote&gt;&lt;blockquote&gt; * Each pixel from the video source is drawn as a rectangle with rotation based on brightness.   &lt;/blockquote&gt;&lt;blockquote&gt; */ &lt;/blockquote&gt;&lt;blockquote&gt; &lt;/blockquote&gt;&lt;blockquote&gt; &lt;/blockquote&gt;&lt;blockquote&gt;import processing.video.*;&lt;/blockquote&gt;&lt;blockquote&gt;import processing.serial.*;// import serial library&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;float diameter = 0.0; // the speed at which the video plays&lt;/blockquote&gt;&lt;blockquote&gt;float maxSpeed = 200.0;&lt;/blockquote&gt;&lt;blockquote&gt;float minSpeed = 1.0;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;MovieMaker mm;  // Declare MovieMaker object&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;Serial myPort; // The serial port&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;// Size of each cell in the grid&lt;/blockquote&gt;&lt;blockquote&gt;int cellSize = 20;&lt;/blockquote&gt;&lt;blockquote&gt;// Number of columns and rows in our system&lt;/blockquote&gt;&lt;blockquote&gt;int cols, rows;&lt;/blockquote&gt;&lt;blockquote&gt;// Variable for capture device&lt;/blockquote&gt;&lt;blockquote&gt;Capture video;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;void setup() {&lt;/blockquote&gt;&lt;blockquote&gt;  size(640, 480, P2D);&lt;/blockquote&gt;&lt;blockquote&gt;  frameRate(30);&lt;/blockquote&gt;&lt;blockquote&gt;  cols = width / cellSize;&lt;/blockquote&gt;&lt;blockquote&gt;  rows = height / cellSize;&lt;/blockquote&gt;&lt;blockquote&gt;  colorMode(RGB, 255, 255, 255, 100);&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;  // Uses the default video input, see the reference if this causes an error&lt;/blockquote&gt;&lt;blockquote&gt;  video = new Capture(this, width, height, 12);&lt;/blockquote&gt;&lt;blockquote&gt;  &lt;/blockquote&gt;&lt;blockquote&gt;  println(Serial.list());&lt;/blockquote&gt;&lt;blockquote&gt;  myPort = new Serial(this, Serial.list()[0], 9600);&lt;/blockquote&gt;&lt;blockquote&gt;  mm = new MovieMaker(this, width, height, "drawing.mov",&lt;/blockquote&gt;&lt;blockquote&gt;                       30, MovieMaker.ANIMATION, MovieMaker.MEDIUM);&lt;/blockquote&gt;&lt;blockquote&gt;  &lt;/blockquote&gt;&lt;blockquote&gt;  background(0);&lt;/blockquote&gt;&lt;blockquote&gt;}&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;void draw() { &lt;/blockquote&gt;&lt;blockquote&gt;  if (video.available()) {&lt;/blockquote&gt;&lt;blockquote&gt;    video.read();&lt;/blockquote&gt;&lt;blockquote&gt;    video.loadPixels();&lt;/blockquote&gt;&lt;blockquote&gt;    &lt;/blockquote&gt;&lt;blockquote&gt;    // Not bothering to clear background&lt;/blockquote&gt;&lt;blockquote&gt;    // background(0);&lt;/blockquote&gt;&lt;blockquote&gt;  &lt;/blockquote&gt;&lt;blockquote&gt;    // Begin loop for columns&lt;/blockquote&gt;&lt;blockquote&gt;    for (int i = 0; i &lt;span class="Apple-style-span" style="font-size: 16px; "&gt;&amp;lt;&lt;/span&gt; cols; i++) {&lt;/blockquote&gt;&lt;blockquote&gt;      // Begin loop for rows&lt;/blockquote&gt;&lt;blockquote&gt;      for (int j = 0; j &lt;span class="Apple-style-span" style="font-size: 16px; "&gt;&amp;lt;&lt;/span&gt; rows; j++) {&lt;/blockquote&gt;&lt;blockquote&gt;      &lt;/blockquote&gt;&lt;blockquote&gt;        // Where are we, pixel-wise?&lt;/blockquote&gt;&lt;blockquote&gt;        int x = i*cellSize;&lt;/blockquote&gt;&lt;blockquote&gt;        int y = j*cellSize;&lt;/blockquote&gt;&lt;blockquote&gt;        int loc = (video.width - x - 1) + y*video.width; // Reversing x to mirror the image&lt;/blockquote&gt;&lt;blockquote&gt;      &lt;/blockquote&gt;&lt;blockquote&gt;        float r = red(video.pixels[loc]);&lt;/blockquote&gt;&lt;blockquote&gt;        float g = green(video.pixels[loc]);&lt;/blockquote&gt;&lt;blockquote&gt;        float b = blue(video.pixels[loc]);&lt;/blockquote&gt;&lt;blockquote&gt;        // Make a new color with an alpha component&lt;/blockquote&gt;&lt;blockquote&gt;        color c = color(r, g, b, 75);&lt;/blockquote&gt;&lt;blockquote&gt;      &lt;/blockquote&gt;&lt;blockquote&gt;        // Code for drawing a single rect&lt;/blockquote&gt;&lt;blockquote&gt;        // Using translate in order for rotation to work properly&lt;/blockquote&gt;&lt;blockquote&gt;        pushMatrix();&lt;/blockquote&gt;&lt;blockquote&gt;        translate(x+cellSize/2, y+cellSize/2);&lt;/blockquote&gt;&lt;blockquote&gt;        // Rotation formula based on brightness&lt;/blockquote&gt;&lt;blockquote&gt;        rotate((2 * PI * brightness(c) / 255.0));&lt;/blockquote&gt;&lt;blockquote&gt;        rectMode(CENTER);&lt;/blockquote&gt;&lt;blockquote&gt;        fill(c);&lt;/blockquote&gt;&lt;blockquote&gt;        noStroke();&lt;/blockquote&gt;&lt;blockquote&gt;        // Rects are larger than the cell for some overlap&lt;/blockquote&gt;&lt;blockquote&gt;        rect(0, 0, diameter, diameter);&lt;/blockquote&gt;&lt;blockquote&gt;        popMatrix();&lt;/blockquote&gt;&lt;blockquote&gt;      }&lt;/blockquote&gt;&lt;blockquote&gt;    }&lt;/blockquote&gt;&lt;blockquote&gt;    &lt;/blockquote&gt;&lt;blockquote&gt;    // want to record video into movie file&lt;/blockquote&gt;&lt;blockquote&gt;    mm.addFrame();  // Add window's pixels to movie&lt;/blockquote&gt;&lt;blockquote&gt;  }&lt;/blockquote&gt;&lt;blockquote&gt;}&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;/**&lt;/blockquote&gt;&lt;blockquote&gt; * serialEvent&lt;/blockquote&gt;&lt;blockquote&gt; *&lt;/blockquote&gt;&lt;blockquote&gt; * This function access the values coming in from the serial port&lt;/blockquote&gt;&lt;blockquote&gt; * It assigns the values to the play speed of the video, called videoSpeed&lt;/blockquote&gt;&lt;blockquote&gt; * The videoSpeed has a range of -5x to +5x normal playing speed&lt;/blockquote&gt;&lt;blockquote&gt; * These values are determined by the minSpeed and maxSpeed variables&lt;/blockquote&gt;&lt;blockquote&gt; * If you alter them you can change the range of speed the video will play&lt;/blockquote&gt;&lt;blockquote&gt; * For this to work, an Arduino must be sending one byte through the serial port&lt;/blockquote&gt;&lt;blockquote&gt; */&lt;/blockquote&gt;&lt;blockquote&gt;void serialEvent (Serial myPort) {&lt;/blockquote&gt;&lt;blockquote&gt;  // get the byte:&lt;/blockquote&gt;&lt;blockquote&gt;  int inByte = myPort.read();&lt;/blockquote&gt;&lt;blockquote&gt;  diameter = map(inByte, 0, 255, minSpeed, maxSpeed);&lt;/blockquote&gt;&lt;blockquote&gt;  // print it:&lt;/blockquote&gt;&lt;blockquote&gt;  println(inByte);&lt;/blockquote&gt;&lt;blockquote&gt;}&lt;/blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote&gt;void keyPressed() {&lt;/blockquote&gt;&lt;blockquote&gt;  if (key == ' ') {&lt;/blockquote&gt;&lt;blockquote&gt;    mm.finish();  // Finish the movie if space bar is pressed!&lt;/blockquote&gt;&lt;blockquote&gt;    exit();&lt;/blockquote&gt;&lt;blockquote&gt;  }&lt;/blockquote&gt;&lt;blockquote&gt;}&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 153, 102);font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-5186060285998607680?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/5186060285998607680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/04/final-class-arduino-and-physical.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/5186060285998607680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/5186060285998607680'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/04/final-class-arduino-and-physical.html' title='Final Class: Arduino and Physical Computing'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-w5VMVKiA3eA/TZdVDOnFjAI/AAAAAAAAAMA/CDDIPr4Y1Qw/s72-c/gsrAndLEDs.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-3363595991033714037</id><published>2011-03-26T10:45:00.026-04:00</published><updated>2011-10-19T19:09:56.544-04:00</updated><title type='text'>Class 3</title><content type='html'>Today's class is going to be an exciting one. We have some new concepts to work with that are a little hard at first to understand but are very powerful. Here is a look at what we are going to learn today:&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Analog Input: Potentiometer (lab)&lt;/li&gt;&lt;li&gt;Thresholds and calibration: Brightness sensor (lab)&lt;/li&gt;&lt;li&gt;Arrays and for loops&lt;/li&gt;&lt;li&gt;Add movement 2: Servo Motors (group lab)&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Analog Input:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The Arduino has 6 pins that allow you to receive analog values from sensors attached to those pins. The Arduino determines the value by reading the voltage coming into those pins and comparing it to the Arduino standard voltage of 5volts dc. We are going to discover how this works by using a &lt;a href="http://en.wikipedia.org/wiki/Potentiometer"&gt;potentiometer&lt;/a&gt;. Create the circuit below and then upload the following code onto the Arduino.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/-4gJ2D6KMGf8/Tp9Jw63u0MI/AAAAAAAAANk/yX6fAiqhqL0/s1600/Screen%2Bshot%2B2011-10-19%2Bat%2B6.04.13%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://3.bp.blogspot.com/-4gJ2D6KMGf8/Tp9Jw63u0MI/AAAAAAAAANk/yX6fAiqhqL0/s400/Screen%2Bshot%2B2011-10-19%2Bat%2B6.04.13%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5665327961040933058" style="cursor: pointer; width: 314px; height: 400px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Analog Input with Potentiometer(pot)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;using the arduinos analog input pins&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Matt Richard&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://idblabs.blogspot.com&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;*/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int potPin = A0; // the pin which the middle pin of the potentiometer is attached&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int potValue = 0; // the value that is sent from the potentimeter to the analog pin&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// create a serial connection&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Serial.begin(9600);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// read the value from the potentiometer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;potValue = analogRead(potPin);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// display the value of the potentiometer in the serial monitor&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102); "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Serial.println(potValue);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Now that we have used a potentiometer lets use the value to vary the delay between turning an LED on and off. Create the circuit below and then upload the following code onto the Arduino. The code is an example available with the Arduino ide found under 3.Analog/AnalogInput.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://2.bp.blogspot.com/-p4hgWbTdw-o/Tp9LGwWZvdI/AAAAAAAAAN8/-DwbGkw3tZ8/s1600/Screen%2Bshot%2B2011-10-19%2Bat%2B6.10.49%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://2.bp.blogspot.com/-p4hgWbTdw-o/Tp9LGwWZvdI/AAAAAAAAAN8/-DwbGkw3tZ8/s400/Screen%2Bshot%2B2011-10-19%2Bat%2B6.10.49%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5665329435685535186" style="cursor: pointer; width: 295px; height: 400px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Analog Input&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Demonstrates analog input by reading an analog sensor on analog pin 0 and&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;turning on and off a light emitting diode(LED) connected to digital pin 13.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The amount of time the LED will be on and off depends on&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;the value obtained by analogRead().&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The circuit:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;* Potentiometer attached to analog input 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;* center pin of the potentiometer to the analog pin&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;* one side pin (either one) to ground&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;* the other side pin to +5V&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;* LED anode (long leg) attached to digital output 13&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;* LED cathode (short leg) attached to ground&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;* Note: because most Arduinos have a built-in LED attached&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;to pin 13 on the board, the LED is optional.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Created by David Cuartielles&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Modified 4 Sep 2010&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;By Tom Igoe&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;This example code is in the public domain.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://arduino.cc/en/Tutorial/AnalogInput&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;*/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int sensorPin = A0; // select the input pin for the potentiometer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int ledPin = 13; // select the pin for the LED&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int sensorValue = 0; // variable to store the value coming from the sensor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// declare the ledPin as an OUTPUT:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;pinMode(ledPin, OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// read the value from the sensor:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;sensorValue = analogRead(sensorPin);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// turn the ledPin on&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;digitalWrite(ledPin, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// stop the program for &lt;/span&gt;&lt;sensorvalue&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;milliseconds:&lt;/span&gt;&lt;/sensorvalue&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;delay(sensorValue);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// turn the ledPin off:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;digitalWrite(ledPin, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// stop the program for for &lt;/span&gt;&lt;sensorvalue&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;milliseconds:&lt;/span&gt;&lt;/sensorvalue&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;delay(sensorValue);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;We can also use a potentiometer to control PWM signals to control an LED. Follow the diagram and then paste the following code. This circuit is almost identical to the last one, other than the LED is changed from pin 13 to pin 6.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/-md5NIgsBSxs/Tp9JxJCNwfI/AAAAAAAAANs/oADzq4-YQMY/s1600/Screen%2Bshot%2B2011-10-19%2Bat%2B6.03.42%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://3.bp.blogspot.com/-md5NIgsBSxs/Tp9JxJCNwfI/AAAAAAAAANs/oADzq4-YQMY/s400/Screen%2Bshot%2B2011-10-19%2Bat%2B6.03.42%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5665327964843000306" style="cursor: pointer; width: 316px; height: 400px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;div&gt;/*&lt;/div&gt;&lt;div&gt;  Analog input, analog output, serial output&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; Reads an analog input pin, maps the result to a range from 0 to 255&lt;/div&gt;&lt;div&gt; and uses the result to set the pulsewidth modulation (PWM) of an output pin.&lt;/div&gt;&lt;div&gt; Also prints the results to the serial monitor.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; The circuit:&lt;/div&gt;&lt;div&gt; * potentiometer connected to analog pin 0.&lt;/div&gt;&lt;div&gt;   Center pin of the potentiometer goes to the analog pin.&lt;/div&gt;&lt;div&gt;   side pins of the potentiometer go to +5V and ground&lt;/div&gt;&lt;div&gt; * LED connected from digital pin 6 to ground&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; created 29 Dec. 2008&lt;/div&gt;&lt;div&gt; Modified 4 Sep 2010&lt;/div&gt;&lt;div&gt; by Tom Igoe&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; This example code is in the public domain.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; */&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;// These constants won't change.  They're used to give names&lt;/div&gt;&lt;div&gt;// to the pins used:&lt;/div&gt;&lt;div&gt;const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to&lt;/div&gt;&lt;div&gt;const int analogOutPin = 6; // Analog output pin that the LED is attached to&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int sensorValue = 0;        // value read from the pot&lt;/div&gt;&lt;div&gt;int outputValue = 0;        // value output to the PWM (analog out)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void setup() {&lt;/div&gt;&lt;div&gt;  // initialize serial communications at 9600 bps:&lt;/div&gt;&lt;div&gt;  Serial.begin(9600); &lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void loop() {&lt;/div&gt;&lt;div&gt;  // read the analog in value:&lt;/div&gt;&lt;div&gt;  sensorValue = analogRead(analogInPin);            &lt;/div&gt;&lt;div&gt;  // map it to the range of the analog out:&lt;/div&gt;&lt;div&gt;  outputValue = map(sensorValue, 0, 1023, 0, 255);  &lt;/div&gt;&lt;div&gt;  // change the analog out value:&lt;/div&gt;&lt;div&gt;  analogWrite(analogOutPin, outputValue);           &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  // print the results to the serial monitor:&lt;/div&gt;&lt;div&gt;  Serial.print("sensor = " );                       &lt;/div&gt;&lt;div&gt;  Serial.print(sensorValue);      &lt;/div&gt;&lt;div&gt;  Serial.print("\t output = ");      &lt;/div&gt;&lt;div&gt;  Serial.println(outputValue);   &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  // wait 10 milliseconds before the next loop&lt;/div&gt;&lt;div&gt;  // for the analog-to-digital converter to settle&lt;/div&gt;&lt;div&gt;  // after the last reading:&lt;/div&gt;&lt;div&gt;  delay(10);                     &lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Thresholds and Calibration:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The potentiometer generated a value from 0-1024, an even range to use as an input. Most sensors do not generate such a nice range of values under normal working conditions. To accurately map a sensor you need to now what the thresholds of the sensor. Each sensor will have a minimum and maximum threshold. Let's use a photocell to change the brightness of an LED. To do this first we will need to determine the minimum and maximum threshold of the photocell. Create the circuit below and then upload the following code onto the Arduino.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/-IJHkqVK_3dQ/Tp9OoLpjZWI/AAAAAAAAAOI/SW1_fTevhPk/s1600/Screen%2Bshot%2B2011-10-19%2Bat%2B6.25.19%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://1.bp.blogspot.com/-IJHkqVK_3dQ/Tp9OoLpjZWI/AAAAAAAAAOI/SW1_fTevhPk/s400/Screen%2Bshot%2B2011-10-19%2Bat%2B6.25.19%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5665333308484183394" style="cursor: pointer; width: 299px; height: 400px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Analog input from photocell to determine LED brightness&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Matt Richard&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://idblab.blogspot.com&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;*/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int sensorPin = A0; // select the input pin for the potentiometer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int ledPin = 6; // select the pin for the LED&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int sensorValue = 0; // variable to store the value coming from the sensor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int minThresh = 0;// replace this number with a lowest number from the serial monitor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int maxThresh = 1000;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102); "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// replace this number with a highest number from the serial monitor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Serial.begin(9600);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// read the value from the sensor:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;sensorValue = analogRead(sensorPin);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Serial.println(sensorValue);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;analogWrite(ledPin, map(sensorValue, minThresh, maxThresh, 0, 255));&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once the program has been uploaded, open the serial monitor to view the incoming values from the photocell. Make note of the value of the photocell in ambient light, this is your maximum threshold. Now cover the photocell with your hand or an object to make it as dark as you can. This value is your minimum threshold. I like to add a small buffer of +-20 to insure that the photocell values do not go out of range under normal conditions, but make sure not to have a number less than 0. This is a simple way to calibrate your sensor. By replacing the values for minThresh and maxThresh with values from the serial monitor the effect of dimming the LED by placing your hand over the photocell has a greater effect on the brightness of the LED.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Arrays and For Loops:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://arduino.cc/en/Reference/Array"&gt;Arrays&lt;/a&gt; are a way of declaring multiple of the same type of variable in a row in memory. Usually they are used with the idea that the values are multiples of the same type of object. What I mean is while the value of the photocell is an integer it doesn't make sense to include it in an array of integers that represent the digital pins used to power LEDs. Arrays are declared a little differently then other variables. Here are a few ways to declare an array:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;int myInts[6];// this creates an array that has 6 places but does not define what the values are&lt;/div&gt;&lt;div&gt;int myPins[] = {2, 4, 8, 3, 6};// this creates an array of 5 places and defines the values&lt;/div&gt;&lt;div&gt;int mySensVals[6] = {2, 4, -8, 3, 2};// this creates an array of 6 places but only defines the first 5 values&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is how you access the values that are store in the arrays above:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;myPins[0], where the value would equal 2.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The number inside of the square brackets [ ] indicates which element to access. Arrays are 0 based, meaning the first element is considered the 0 place not the 1st place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is how you change the value of an element of an array:&lt;/div&gt;&lt;div&gt;myPins[1] = 9;// now the values for myPins look like this: {2, 9, 8, 3, 6}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The real power of arrays is unleashed when combined with &lt;a href="http://arduino.cc/en/Reference/For"&gt;for loops&lt;/a&gt;. The structure of a for loop is a little confusing at first, but once you understand how to use them they are essential. Basically a for loop is a way of repeating a command a determined number of times. You can use an array to count from any number by any number to any number. This makes it perfect for working with arrays because instead of manually putting 0-4 inside of the [ ] to access the values of myPins array, you can use a variable.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is a for loop that prints the values of myPins array to the serial monitor:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;for(int i = 0; i &amp;lt; 5; i++){&lt;div&gt;Serial.print(myPins[i]);&lt;/div&gt;&lt;div&gt;Serial.print(", ");&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;Serial.println();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This snippet of code will display the values with a comma and space between each value and then a line break after the last element has been printed. I recommend that you take a look at the for loop link above. The guys at Arduino have a wonderful description of how the mechanics work.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's put it into action so you can see how easy they are to use. Create the circuit below and then upload the following code onto the Arduino.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); "&gt;&lt;blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:arial;color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="color: rgb(0, 0, 0);  font-family:Georgia, serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Working with Motors&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The arduino can allow you to control much more than LEDs. In fact you can use the arduino to physically change your environment by using motors. There are many different types of motors, but the most common are brush DC motors, servo motors, and stepper motors.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://en.wikipedia.org/wiki/Brushed_DC_electric_motor"&gt;Brush DC motors&lt;/a&gt; : These are the most common motors. You will find them inside of toys, fans, blenders, printers, drills… the list goes on and on. The motor has two terminals, a positive and negative terminal. Simply apply power to one terminal and ground to the other and the motor will spin. Reverse which terminal gets power and ground and the direction reverses. An easy way to control the direction and power source of a motor is to use and &lt;a href="http://itp.nyu.edu/physcomp/Labs/DCMotorControl"&gt;H-Bridge&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://en.wikipedia.org/wiki/Stepper_motor"&gt;Stepper Motor&lt;/a&gt; : Stepper motors break down a full rotation into a number of steps. Rather than continually rotating like a DC motor, the stepper increments in steps or fractions of a rotation. While you can also use an &lt;a href="http://itp.nyu.edu/physcomp/Tutorials/StepperL293HBridge"&gt;H-Bridge&lt;/a&gt; to control a stepper it is easiest to use the &lt;a href="http://www.sparkfun.com/products/10267"&gt;EasyDriver&lt;/a&gt; stepper controller.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://en.wikipedia.org/wiki/Servo_motor"&gt;Servo Motor&lt;/a&gt; : Servos are similar to Steppers, in that you tell it to go to a certain angle and it will stop at that angle. The difference is that most packages only have a rotational range of 180 degrees. Servos are used a lot in RC cars, boats and planes to control the steering mechanisms. At its heart a servo is a DC motor with circuitry to understand how far it has rotated. It also usually has gearing to increase its torque.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Servos are incredible easy to use with the arduino. They have three wires, power, ground, and signal. A PWM signal is sent down the signal line and the servo uses that to determine where to rotate to. Arduino has a library that makes this all very easy for us. Build the circuit below and we will control the servo with a potentiometer.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color: rgb(0, 0, 0);  font-family:Georgia, serif;"&gt;&lt;a href="http://2.bp.blogspot.com/-gE3WYY9bNlk/Tirm442ysPI/AAAAAAAAAMs/odpp8C1_WVQ/s1600/class3_potAndServo.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://2.bp.blogspot.com/-gE3WYY9bNlk/Tirm442ysPI/AAAAAAAAAMs/odpp8C1_WVQ/s400/class3_potAndServo.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5632568148989489394" style="cursor: pointer; width: 400px; height: 290px; " /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;div&gt;// Controlling a servo position using a potentiometer (variable resistor) &lt;/div&gt;&lt;div&gt;// by Michal Rinott &lt;http: it="" rinott=""&gt; &lt;/http:&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &lt;servo.h&gt; &lt;/servo.h&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Servo myservo;  // create servo object to control a servo &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;int potpin = 2;  // analog pin used to connect the potentiometer&lt;/div&gt;&lt;div&gt;int val;    // variable to read the value from the analog pin &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;void setup() &lt;/div&gt;&lt;div&gt;{ &lt;/div&gt;&lt;div&gt;  myservo.attach(9);  // attaches the servo on pin 9 to the servo object &lt;/div&gt;&lt;div&gt;} &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;void loop() &lt;/div&gt;&lt;div&gt;{ &lt;/div&gt;&lt;div&gt;  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023) &lt;/div&gt;&lt;div&gt;  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) &lt;/div&gt;&lt;div&gt;  myservo.write(val);                  // sets the servo position according to the scaled value &lt;/div&gt;&lt;div&gt;  delay(15);                           // waits for the servo to get there &lt;/div&gt;&lt;div&gt;} &lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-3363595991033714037?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/3363595991033714037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/03/class-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3363595991033714037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3363595991033714037'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/03/class-3.html' title='Class 3'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-4gJ2D6KMGf8/Tp9Jw63u0MI/AAAAAAAAANk/yX6fAiqhqL0/s72-c/Screen%2Bshot%2B2011-10-19%2Bat%2B6.04.13%2BPM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-4938310327981034312</id><published>2011-03-19T09:53:00.024-04:00</published><updated>2011-10-05T19:23:29.960-04:00</updated><title type='text'>More fun with Arduino! PComp with Arduino Class 2</title><content type='html'>Here is a short list of the topics we will cover for class 2:&lt;br /&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Commenting (review)&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-weight: normal;font-size:100%;"&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline !important; "&gt;&lt;span class="Apple-style-span"&gt;Basic Programming Structure&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Pulse Width Modulation(pwm)&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Where to find components/tools/cool stuff&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;b&gt;Commenting (code):&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Commenting code is an important part of making sense of what is going on in the code, especi&lt;/span&gt;&lt;b style="font-weight: normal; "&gt;ally when you come back to your program at a later date. Using comments, you can leave descriptions of the processes and variables used in your program. There are two kinds of commenting, line commenting(//...) and block comments(/*...*/).&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Line&lt;/span&gt;&lt;b style="font-weight: normal; "&gt; commenting occurs each time you place two forward slashes in your code. The rest of the text on the line with the slashes is disregarded by the compiler. This is a great way to turn off one line of code but still have it available for a later time. Block comments use a combination of */ to begin the comment and */ to end the comment. Anything inside of those characters will be disregarded by the compiler. This allows you to turn off big chunks of code and create proper code descriptions.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline ! important;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;This is a block comment. Everything inside of the "/*" and "*/" is commented out.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline !important; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;*/&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;b&gt;// this is also a comment&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;b&gt;&lt;b&gt;&lt;h4 style="display: inline ! important;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Variables (code):&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Variables are a way of storing and accessing values in a program. There are many different types of variables, each type has a limit to how big of a number or even what type of number can be stored inside.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;The standard variables available to us through Arduino are:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;h4&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;boolean: A boolean holds one of two values, true or false. (Each boolean variable occupies one byte of memory.)&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;char: A data type that takes up 1 byte of memory that stores a character value. Character literals are written in single quotes, like this: 'A' (for multiple characters - strings - use double quotes: "ABC").&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;byte: A byte stores an 8-bit unsigned number, from 0 to 255.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;int: Integers are your primary datatype for number storage, and store a 2 byte value. This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1).&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;word: A word stores a 16-bit unsigned number, from 0 to 65535. Same as an unsigned int.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;long: Long variables are extended size variables for number storage, and store 32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;float: Datatype for floating-point numbers, a number that has a decimal point. Floating-point numbers are often used to approximate analog and continuous values because they have greater resolution than integers. Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38. They are stored as 32 bits (4 bytes) of information.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;double: Double precision floating point number. Occupies 4 bytes. Same thing as a float.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;string: Strings are represented as arrays of type char.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;array: An array is a collection of variables that are accessed with an index number. Arrays in the C programming language, on which Arduino is based, can be complicated, but using simple arrays is relatively straightforward.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Program Structure (code):&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline ! important;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;It is important to have a standard structure when writing a program. A structure will make it easy for you and others to locate all of the components of your program.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;The first part of the program should be a description of what the program is using block comments.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;The second section is where you place all of your variables. Start with constants first and then group them according to their purpose. Don't forget to leave detailed comments.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;The third section is for the setup() function. Void setup() is where you initialize your digital pins and communication lines.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;The fourth section is for the loop() function. Void loop() is what gets executed by the microcontroller on every loop or frame. This will get repeated over and over until the microcontroller is turned off.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;The fifth section(not depicted) is used for functions you create.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;PWM - introduction to Pulse Width Modulation:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Pulse Width Modulation is a process of taking a digital pin(on/off) and creating a gradient value or change. By pulsing the pin on and off in varying square waves you can achieve a range of values which can be used to "dim" an LED. I say "dim" because really the LED is being turned on and off so fast that our eyes perceive it as dim.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Fading using delay(lab):&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/-v5xbDLQEioI/TozhdF5UjDI/AAAAAAAAANU/y0nw794LjQ4/s1600/Screen%2Bshot%2B2011-10-05%2Bat%2B6.25.59%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://3.bp.blogspot.com/-v5xbDLQEioI/TozhdF5UjDI/AAAAAAAAANU/y0nw794LjQ4/s400/Screen%2Bshot%2B2011-10-05%2Bat%2B6.25.59%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5660146721612926002" style="cursor: pointer; width: 311px; height: 400px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;span class="Apple-style-span"&gt;&lt;h4&gt;&lt;/h4&gt;&lt;h4&gt;/*&lt;/h4&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;span class="Apple-style-span"&gt;&lt;h4&gt;&lt;/h4&gt;&lt;h4&gt; Fade&lt;/h4&gt;&lt;h4&gt; This example shows how to fade an LED on pin 9&lt;/h4&gt;&lt;h4&gt; using the analogWrite() function.&lt;/h4&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt; This example code is in the public domain.&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:85%;"&gt;&lt;span class="Apple-style-span"&gt;&lt;h4&gt;&lt;/h4&gt;&lt;h4&gt; */&lt;/h4&gt;&lt;h4&gt;int brightness = 0;    // how bright the LED is&lt;/h4&gt;&lt;h4&gt;int fadeAmount = 5;    // how many points to fade the LED by&lt;/h4&gt;&lt;h4&gt;&lt;br /&gt;&lt;/h4&gt;&lt;h4&gt;void setup()  { &lt;/h4&gt;&lt;h4&gt;  // declare pin 6 to be an output:&lt;/h4&gt;&lt;h4&gt;  pinMode(6, OUTPUT);&lt;/h4&gt;&lt;h4&gt;} &lt;/h4&gt;&lt;h4&gt;&lt;br /&gt;&lt;/h4&gt;&lt;h4&gt;void loop()  { &lt;/h4&gt;&lt;h4&gt;  // set the brightness of pin 6:&lt;/h4&gt;&lt;h4&gt;  analogWrite(6, brightness);    &lt;/h4&gt;&lt;h4&gt;&lt;br /&gt;&lt;/h4&gt;&lt;h4&gt;  // change the brightness for next time through the loop:&lt;/h4&gt;&lt;h4&gt;  brightness = brightness + fadeAmount;&lt;/h4&gt;&lt;h4&gt;&lt;br /&gt;&lt;/h4&gt;&lt;h4&gt;  // reverse the direction of the fading at the ends of the fade: &lt;/h4&gt;&lt;h4&gt;  if (brightness == 0 || brightness == 255) {&lt;/h4&gt;&lt;h4&gt;    fadeAmount = -fadeAmount ; &lt;/h4&gt;&lt;h4&gt;  }     &lt;/h4&gt;&lt;h4&gt;  // wait for 30 milliseconds to see the dimming effect    &lt;/h4&gt;&lt;h4&gt;  delay(30);                            &lt;/h4&gt;&lt;h4&gt;}&lt;/h4&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline !important; "&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline !important; "&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline !important; "&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline !important; "&gt;&lt;br /&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/h4&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;&lt;h4 style="display: inline ! important;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;Fading using timer(lab):&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/-SDzuXwfbsaA/TozhdIwdpvI/AAAAAAAAANc/B5tztzjICSg/s1600/Screen%2Bshot%2B2011-10-05%2Bat%2B6.50.21%2BPM.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://4.bp.blogspot.com/-SDzuXwfbsaA/TozhdIwdpvI/AAAAAAAAANc/B5tztzjICSg/s400/Screen%2Bshot%2B2011-10-05%2Bat%2B6.50.21%2BPM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5660146722381080306" style="cursor: pointer; width: 262px; height: 400px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt; Fade RGB LEDs&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt; This example shows how to fade an LED on pin 3,5,6&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt; using the analogWrite() function.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt; This example code is in the public domain.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt; */&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;int brightnessBlue = 0;    // how bright the BLUE LED is&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;int fadeAmountBlue = 5;    // how many points to fade the BLUE LED by&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;int brightnessGreen = 85;    // how bright the GREEN LED is&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;int fadeAmountGreen = 5;    // how many points to fade the BLUE LED by&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;int brightnessRed = 170;    // how bright the RED LED is&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;int fadeAmountRed = 5;    // how many points to fade the BLUE LED by&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;void setup()  { &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // declare pin 9 to be an output:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  pinMode(3, OUTPUT);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  pinMode(5, OUTPUT);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  pinMode(6, OUTPUT);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;} &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;void loop()  { &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // set the brightness of pin 3, 5, and 6:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  analogWrite(3, brightnessBlue);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  analogWrite(5, brightnessGreen);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  analogWrite(6, brightnessRed);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // BLUE LED LOGIC BEGIN&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // change the brightness for next time through the loop:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  brightnessBlue = brightnessBlue + fadeAmountBlue;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // reverse the direction of the fading at the ends of the fade: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  if (brightnessBlue == 0 || brightnessBlue == 255) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;    fadeAmountBlue = -fadeAmountBlue ; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // BLUE LED LOGIC END&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // GREEN LED LOGIC BEGIN&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // change the brightness for next time through the loop:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  brightnessGreen = brightnessGreen + fadeAmountGreen;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // reverse the direction of the fading at the ends of the fade: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  if (brightnessGreen == 0 || brightnessGreen == 255) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;    fadeAmountGreen = -fadeAmountGreen ; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // GREEN LED LOGIC END&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // RED LED LOGIC BEGIN&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // change the brightness for next time through the loop:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  brightnessRed = brightnessRed + fadeAmountRed;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // reverse the direction of the fading at the ends of the fade: &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  if (brightnessRed == 0 || brightnessRed == 255) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;    fadeAmountRed = -fadeAmountRed ; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // RED LED LOGIC END&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  // wait for 30 milliseconds to see the dimming effect    &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;  delay(30);                            &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#990000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline ! important;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline ! important;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;Where to find components/tools/cool stuff:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;At some point you are going to need to add to your project. If you need it local your only options are a RadioShack or a small electronics seller in China Town. The address is 269 Canal Street and the store is located in the back. If you don't need it today, then you have a much wider option for price and availability online. I have included some of my most frequented online stores along with what they stock.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;Local:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;RadioShack - common components, wires and tools&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;269 Canal Electronics - rarer components, call and ask, not cheap, in China Town&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Electronics:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://sparkfun.com/"&gt;SparkFun Electronics&lt;/a&gt; - Hacker/Hobbyist Electronics and Arduino&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://adafruit.com/"&gt;Adafruit&lt;/a&gt; &lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;h4 style="display: inline !important; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;- Hacker/Hobbyist Electronics and Arduino&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://evilmadscience.com/"&gt;Evil Mad Science&lt;/a&gt; - Arduino and cheap LEDs&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://www.macetech.com/store"&gt;MaceTech&lt;/a&gt; - LED control for Arduino&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://www.goldmine-elec.com/"&gt;Electronics Goldmine&lt;/a&gt; - Close out prices on electronic parts and tools, mostly older&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;a href="http://allelectronics.com/"&gt;All Electronics&lt;/a&gt; - Close out prices on electronic parts and tools, mostly new&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://jameco.com/"&gt;Jameco&lt;/a&gt; - Professional Electronic Parts and ICs&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"&gt;&lt;a href="http://mouser.com/"&gt;Mouser&lt;/a&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;- Professional Electronic Parts and ICs&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Robotics:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://pololu.com/"&gt;Pololu&lt;/a&gt; - Motor controllers and sensors&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://lynxmotion.com/"&gt;LynxMotion&lt;/a&gt; - Servo housings and metal robot kits&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Hardware/Materials:&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://smallparts.com/"&gt;SmallParts&lt;/a&gt; - small mechanic components and hand tools&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;h4 style="display: inline ! important;"&gt;&lt;/h4&gt;&lt;/span&gt;&lt;h4 style="display: inline !important; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;a href="http://www.mcmaster.com/"&gt;McMaster Carr&lt;/a&gt; - all sorts of awesome building materials and tools, delivers fast&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;b&gt;&lt;b&gt;&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;b&gt;&lt;b&gt;&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-4938310327981034312?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/4938310327981034312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/03/more-fun-with-arduino-pcomp-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4938310327981034312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4938310327981034312'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/03/more-fun-with-arduino-pcomp-with.html' title='More fun with Arduino! PComp with Arduino Class 2'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-v5xbDLQEioI/TozhdF5UjDI/AAAAAAAAANU/y0nw794LjQ4/s72-c/Screen%2Bshot%2B2011-10-05%2Bat%2B6.25.59%2BPM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-1194017413619197823</id><published>2011-03-11T19:33:00.013-05:00</published><updated>2011-03-12T12:41:25.752-05:00</updated><title type='text'>Welcome to Arduino! PComp with Arduino Class 1</title><content type='html'>&lt;div&gt;Hello everyone, I hope your day has been well and that you ate a big breakfast because we are going to have a lot of fun.&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;Names and Introductions&lt;/h4&gt;&lt;br /&gt;&lt;div&gt;Just a quick introduction so we can find out your name and why you are interested in the class and what your experience with programming and circuits is.&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;What to expect form the class&lt;/h4&gt;&lt;br /&gt;&lt;div&gt;Here is a brief look at the run down of the class:&lt;br /&gt;Day 1&lt;br /&gt;A definition of what Physical computing is and how and why it is used.&lt;br /&gt;Information about the Arduino and why it is a great platform for physical computing.&lt;br /&gt;Overview of the Arduino website.&lt;br /&gt;How to install and run Arduino.&lt;br /&gt;Overview of the kit.&lt;br /&gt;What tools you need and where to get them.&lt;br /&gt;Blink (lab)&lt;br /&gt;Input &amp; Output&lt;br /&gt;Digital &amp; Analog&lt;br /&gt;&lt;br /&gt;Day 2&lt;br /&gt;Soldering  (lab)&lt;br /&gt;Multimeter&lt;br /&gt;Comment (code)&lt;br /&gt;Variables (code)&lt;br /&gt;Program structure (code)&lt;br /&gt;Functions (code)&lt;br /&gt;PWM&lt;br /&gt;Fading using timer (lab)&lt;br /&gt;Where to find components&lt;br /&gt;&lt;br /&gt;Day 3&lt;br /&gt;Fade timing: modulo (lab)&lt;br /&gt;Multiple LEDs: arrays and for loops (lab)&lt;br /&gt;Potentiometer: serial output (lab)&lt;br /&gt;Control LED with pot: mapping (lab)&lt;br /&gt;Brightness sensor: thresholds and calibration(lab)&lt;br /&gt;Button counter w/state change (lab)&lt;br /&gt;&lt;br /&gt;Day 4&lt;br /&gt;Handling alternative power sources&lt;br /&gt;Smoothing sensor values&lt;br /&gt;Projects (color mixer, chandelier) &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;What is Physical Computing?&lt;/h4&gt;&lt;br /&gt;&lt;div&gt;Physical Computing, or Pcomp for short, refers to the practice of using a computer to interfacing with the natural physical world. The process can include receiving data from the natural world and/or creating an output outside of the computer that effects the world. We will learn how to use microcontrollers as an intermediary between the physical world and your computer.&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;Intro to Arduino, Welcome to the club&lt;/h4&gt;&lt;br /&gt;&lt;div&gt;The Arduino is a wonderful prototyping platform for a number of reasons. The Arduino uses an open source hardware business model. What this means is that they give away for free exactly how to make their product and they also allow you to take those plans and make their product and sell it, I believe as long as you do the same. This breeds an environment where everyone shares and everyone succeeds together growing together as the collective knowledge grows. This means that there are tons of code lying around the web waiting for you to search for them and throw them onto your arduino, making simple work of simple projects. This also means that many people have &lt;a href="http://shieldlist.org/"&gt;designed add-ons&lt;/a&gt; to the original platform that interface flawlessly and add a great deal of functionality. So welcome to the club, have fun and enjoy the life.&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;How to Install Arduino&lt;/h4&gt;&lt;br /&gt;&lt;div&gt;The people at Arduino have put together a wonderful intro to the arduino for any of the major platforms. Check out the &lt;a href="http://arduino.cc/en/Guide/HomePage"&gt;link&lt;/a&gt; and follow along to install get started when you get back to your house.&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;Arduino web resources&lt;/h4&gt;&lt;br /&gt;&lt;div&gt;There are  a ton of web resources available for the Arduino. Here are a few of my go to places to look for help:&lt;br /&gt;The Arduino website includes an entire &lt;a href="http://arduino.cc/en/Reference/HomePage"&gt;run down of the arduino language&lt;/a&gt;.&lt;br /&gt;The website also includes a ton on how to get started including &lt;a href="http://arduino.cc/en/Tutorial/HomePage"&gt;examples&lt;/a&gt;, &lt;a href="http://arduino.cc/en/Tutorial/Foundations"&gt;foundations&lt;/a&gt;, and &lt;a href="http://arduino.cc/en/Tutorial/Links"&gt;links&lt;/a&gt; to other resources.&lt;br /&gt;Along with the code that comes with Arduino, you can use code people have created to work with Arduino. These are called libraries and they can be found &lt;a href="http://arduino.cc/en/Reference/Libraries"&gt;here&lt;/a&gt;. Most libraries will have links to more information on how to use the code they provide.&lt;br /&gt;While you might think that you have a unique idea, this is almost certainly not the case. Check the &lt;a href="http://www.arduino.cc/forum/"&gt;forums at Arduino&lt;/a&gt; (&lt;a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl"&gt;old forum&lt;/a&gt;) to see if anyone has already solved the problem you are trying to figure out.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;What are our materials&lt;/h4&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-ga_cnY-dziQ/TXrBOpq0xlI/AAAAAAAAALI/k3-Z9kReHnA/s1600/arduinoKit.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://3.bp.blogspot.com/-ga_cnY-dziQ/TXrBOpq0xlI/AAAAAAAAALI/k3-Z9kReHnA/s400/arduinoKit.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5582987145526953554" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;Here is a run down of the parts in the kit:&lt;br /&gt;&lt;li&gt;1 &lt;a href="http://arduino.cc/en/Main/ArduinoBoardUno"&gt;Arduino Uno&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;1 &lt;a href="http://en.wikipedia.org/wiki/Breadboard"&gt;breadboard&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;1 USB cable (A to B)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;2 &lt;a href="http://en.wikipedia.org/wiki/Momentary_switch#Biased_switches"&gt;momentary(or biased) switches&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;2 &lt;a href="http://en.wikipedia.org/wiki/Potentiometers"&gt;potentiometers&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;1 &lt;a href="http://en.wikipedia.org/wiki/Photoresistor"&gt;photoresistor&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;5 red &lt;a href="http://en.wikipedia.org/wiki/Light-emitting_diode"&gt;LEDs&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;3 superbrite &lt;a href="http://en.wikipedia.org/wiki/Light-emitting_diode"&gt;LEDs&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;5 100 ohm &lt;a href="http://en.wikipedia.org/wiki/Resistor"&gt;resistors&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;5 1000 ohm &lt;a href="http://en.wikipedia.org/wiki/Resistor"&gt;resistors&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;5 10000 ohm &lt;a href="http://en.wikipedia.org/wiki/Resistor"&gt;resistors&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;1 bundle of jumper wires&lt;/li&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;Lets make something blink!&lt;/h4&gt;&lt;br /&gt;&lt;div&gt;For startes we are going to use the basic Arduino introduction sketch, the blinking LED. Now while this is a basic sketch, it is an amazing experience, I remember my first blinking LED well. Lets jump to the Arduino site to take a look at the &lt;a href="http://arduino.cc/en/Tutorial/Blink"&gt;sketch&lt;/a&gt;.&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;The difference between input and output&lt;/h4&gt;&lt;br /&gt;&lt;div&gt;This is pretty simple, inputs are values and processes associated with things coming into the Arduino, while an output is a value that is sent out from the Arduino. Human inputs are our f&lt;a href="http://www.scientificpsychic.com/workbook/chapter2.htm"&gt;ive senses&lt;/a&gt; and our outputs are using our body in any way to effect the outside world for example talking.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-1194017413619197823?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/1194017413619197823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/03/welcome-to-arduino-pcomp-with-arduino.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/1194017413619197823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/1194017413619197823'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/03/welcome-to-arduino-pcomp-with-arduino.html' title='Welcome to Arduino! PComp with Arduino Class 1'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-ga_cnY-dziQ/TXrBOpq0xlI/AAAAAAAAALI/k3-Z9kReHnA/s72-c/arduinoKit.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-9016539721489976414</id><published>2011-01-22T19:55:00.028-05:00</published><updated>2011-01-23T12:12:49.923-05:00</updated><title type='text'>Physical Computing with Arduino: class 3</title><content type='html'>Today's class is going to be an exciting one. We have some new concepts to work with that are a little hard at first to understand but are very powerful. Here is a look at what we are going to learn today:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;modulo: Fade timing (lab)&lt;/li&gt;&lt;li&gt;analog input: Potentiometer (lab)&lt;/li&gt;&lt;li&gt;mapping: control LED with a Pot(lab)&lt;/li&gt;&lt;li&gt;thresholds and calibration: Brightness sensor (lab)&lt;/li&gt;&lt;li&gt;arrays and for loops: Multiple LEDs (lab)&lt;/li&gt;&lt;li&gt;Button counter w/state change (lab)&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Modulo:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Modulo is an mathematical operator that calculates the remainder when one integer is divided by another. It is very useful for keeping a number with in a set of numbers, or counting to a certain number over and over. Lets take a look at how it works:&lt;/div&gt;&lt;div&gt;0 % 4 = 0&lt;/div&gt;&lt;div&gt;1 % 4 = 1&lt;/div&gt;&lt;div&gt;2 % 4 = 2&lt;/div&gt;&lt;div&gt;3 % 4 = 3&lt;/div&gt;&lt;div&gt;4 % 4 = 0&lt;/div&gt;&lt;div&gt;5 % 4 = 1&lt;/div&gt;&lt;div&gt;6 % 4 = 2&lt;/div&gt;&lt;div&gt;7 % 4 = 3&lt;/div&gt;&lt;div&gt;8 % 4 = 0&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first number can keep growing but the result will only be a number between 0-3. If you modulo by 255, instead of 4, you have a great number to throw into the analogWrite() command to PWM a digital pin. Thats just what we are going to do. In fact lets make a simple "clock" and then a metronome.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Using the function millis() returns the number of milliseconds since the Arduino has begun running a program. We can visualize the length of time the Arduino has been running a way that we recognize by chunking it into blocks of seconds, or fractions of seconds. Make the following circuit and then upload the corresponding code to make a simple clock.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/_HS79_lZtUkM/TTMo7PqhbMI/AAAAAAAAAJ0/kmWn7dCedK4/s1600/class2_led_pwm.jpg"&gt;&lt;img src="http://3.bp.blogspot.com/_HS79_lZtUkM/TTMo7PqhbMI/AAAAAAAAAJ0/kmWn7dCedK4/s400/class2_led_pwm.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5562834963014970562" style="cursor: pointer; width: 400px; height: 281px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Simple Clock&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Using % (modulo) and millis() to make a simple clock that&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;PWMs an LED to fractions of a second&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Matt Richard&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://idblab.blogspot.com&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;*/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmPin = 6;// digital pin to connect to LED&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmVal = 0;// variable that represents the PWM value for the LED to be placed in the analogWrite(pin, value) command.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int maxPWM = 256;// used with % to keep pwmVal between 0-255&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int divisor = 2;// used to keep the increment of light and time relative&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmValIncrement = maxPWM / divisor;// if this # is a factor of 256 then the brightness steps will be even&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int second = 1000;// number of milliseconds in one second&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int time = second / divisor;// the increment in time that will trigger a change in the pwmVal&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Serial.begin(115200);// begin a serial communication so we can see the millis count up.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// if the amount of time has passed then...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;if(millis() % time == 0){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;pwmVal = pwmVal + pwmValIncrement;// the value of the LED equals itself plus the LED light increment&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;pwmVal = pwmVal % maxPWM;// make sure the value of the LED is not greater than 255, if it is loop it back to 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;analogWrite(pwmPin, pwmVal);// PWM the led&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Serial.println("time");// displays the change in light along side the change in millis&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Serial.println(millis() % 1000);// displays the change in millis&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Analog Input:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The Arduino has 6 pins that allow you to receive analog values from sensors attached to those pins. The Arduino determines the value by reading the voltage coming into those pins and comparing it to the Arduino standard voltage of 5volts dc. We are going to discover how this works by using a &lt;a href="http://en.wikipedia.org/wiki/Potentiometer"&gt;potentiometer&lt;/a&gt;. Create the circuit below and then upload the following code onto the Arduino.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/_HS79_lZtUkM/TTuGA59UXEI/AAAAAAAAAKc/vyemEit2MEU/s1600/class3_pot.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/_HS79_lZtUkM/TTuGA59UXEI/AAAAAAAAAKc/vyemEit2MEU/s400/class3_pot.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5565189114662509634" style="cursor: pointer; width: 400px; height: 281px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  Analog Input with Potentiometer(pot)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  using the arduinos analog input pins &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  Matt Richard&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  http://idblabs.blogspot.com&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int potPin = A0;    // the pin which the middle pin of the potentiometer is attached&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int potValue = 0;  // the value that is sent from the potentimeter to the analog input pin&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // create a serial connection so we can view the potentiometer readings in the serial monitor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  Serial.begin(9600);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // read the value from the potentiometer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  potValue = analogRead(potPin);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // display the value of the potentiometer in the serial monitor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  Serial.println(potValue);  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Now that we have used a potentiometer lets use the value to vary the delay between turning an LED on and off. Create the circuit below and then upload the following code onto the Arduino. The code is an example available with the Arduino ide found under 3.Analog/AnalogInput.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/_HS79_lZtUkM/TTuY_W8dYMI/AAAAAAAAAKk/TvWGrLztooM/s1600/class3_led_pot.jpg"&gt;&lt;img src="http://4.bp.blogspot.com/_HS79_lZtUkM/TTuY_W8dYMI/AAAAAAAAAKk/TvWGrLztooM/s400/class3_led_pot.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5565209978804723906" style="cursor: pointer; width: 400px; height: 281px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  Analog Input&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; Demonstrates analog input by reading an analog sensor on analog pin 0 and&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; turning on and off a light emitting diode(LED)  connected to digital pin 13. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; The amount of time the LED will be on and off depends on&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; the value obtained by analogRead(). &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; The circuit:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; * Potentiometer attached to analog input 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; * center pin of the potentiometer to the analog pin&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; * one side pin (either one) to ground&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; * the other side pin to +5V&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; * LED anode (long leg) attached to digital output 13&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; * LED cathode (short leg) attached to ground&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; * Note: because most Arduinos have a built-in LED attached &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; to pin 13 on the board, the LED is optional.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; Created by David Cuartielles&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; Modified 4 Sep 2010&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; By Tom Igoe&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; This example code is in the public domain.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; http://arduino.cc/en/Tutorial/AnalogInput&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int sensorPin = A0;    // select the input pin for the potentiometer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int ledPin = 13;      // select the pin for the LED&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int sensorValue = 0;  // variable to store the value coming from the sensor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // declare the ledPin as an OUTPUT:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  pinMode(ledPin, OUTPUT);  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // read the value from the sensor:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  sensorValue = analogRead(sensorPin);    &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // turn the ledPin on&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  digitalWrite(ledPin, HIGH);  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // stop the program for &lt;sensorvalue&gt; milliseconds:&lt;/sensorvalue&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  delay(sensorValue);          &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // turn the ledPin off:        &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  digitalWrite(ledPin, LOW);   &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // stop the program for for &lt;sensorvalue&gt; milliseconds:&lt;/sensorvalue&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  delay(sensorValue);                  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Thresholds and Calibration:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The potentiometer generated a value from 0-1024 a even range to use as an input. Most sensors do not generate such a nice range of values under normal working conditions. To accurately map a sensor you need to now what the thresholds of the sensor. Each sensor will have a minimum and maximum threshold. Lets use a photocell to change the brightness of an LED. To do this first we will need to determine the minimum and maximum threshold of the photocell.  Create the circuit below and then upload the following code onto the Arduino.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://2.bp.blogspot.com/_HS79_lZtUkM/TTvBSe5Hf4I/AAAAAAAAAK0/kKMDRW8FxPk/s1600/class3_led_photocell.jpg"&gt;&lt;img src="http://2.bp.blogspot.com/_HS79_lZtUkM/TTvBSe5Hf4I/AAAAAAAAAK0/kKMDRW8FxPk/s400/class3_led_photocell.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5565254287820816258" style="cursor: pointer; width: 400px; height: 281px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;Analog input from photocell to determine LED brightness&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; Matt Richard&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; http://idblab.blogspot.com&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; */&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int sensorPin = A0;    // select the input pin for the potentiometer&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int ledPin = 6;      // select the pin for the LED&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int sensorValue = 0;  // variable to store the value coming from the sensor&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int minThresh = 0;// replace this number with a lowest number from the serial monitor&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int maxThresh = 1000;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(255, 153, 102); "&gt;// replace this number with a highest number from the serial monitor&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;void setup() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  Serial.begin(9600);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;void loop() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // read the value from the sensor:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  sensorValue = analogRead(sensorPin);    &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  Serial.println(sensorValue);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  analogWrite(ledPin, map(sensorValue, minThresh, maxThresh, 0, 255));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once the program has been uploaded, open the serial monitor to view the incoming values from the photocell.  Make note of the value of the photocell in ambient light, this is your maximum threshold.  Now cover the photocell with your hand or an object to make it as dark as you can. This value is your minimum threshold.  I like to add a small buffer of +-20 to insure that the photocell values do not go out of range under normal conditions, but make sure not to have a number less than 0.  This is a simple way to calibrate your sensor.  By replacing the values for minThresh and maxThresh with values from the serial monitor the effect of dimming the LED by placing your hand over the photocell has a greater effect on the brightness of the LED.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Arrays and For Loops:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://arduino.cc/en/Reference/Array"&gt;Arrays&lt;/a&gt; are a way of declaring multiple of the same type of variable in a row in memory. Usually they are used with the idea that the values are multiples of the same type of object. What I mean is while the value of the photocell is an integer it doesn't make sense to include it in an array of integers that represent the digital pins used to power LEDs. Arrays are declared a little differently then other variables. Here are a few ways to declare an array:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;int myInts[6];// this creates an array that has 6 places but does not define what the values are&lt;/div&gt;&lt;div&gt;int myPins[] = {2, 4, 8, 3, 6};// this creates an array of 5 places and defines the values&lt;/div&gt;&lt;div&gt;int mySensVals[6] = {2, 4, -8, 3, 2};// this creates an array of 6 places but only defines the first 5 values&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is how you access the values that are store in the arrays above:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;myPins[0] + 1 = 3 &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The number inside of the square brackets [ ] indicates which value to access. Arrays are 0 based, meaning the first value is considered the 0 place not the 1st place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is how you change the value of an element of an array:&lt;/div&gt;&lt;div&gt;myPins[1] = 9;// now the values for myPins look like this:  {2, 9, 8, 3, 6}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The real power of arrays is unleashed when combined with &lt;a href="http://arduino.cc/en/Reference/For"&gt;for loops&lt;/a&gt;. The structure of a for loop is a little confusing at first, but once you understand how to use them they are essential. Basically a for loop is a way of repeating a command a determined number of times. You can use an array to count from any number by any number to any number.  This makes it perfect for working with arrays because instead of manually putting 0-4 inside of the [ ] to access the values of myPins array, you can use a variable.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is a for loop that prints the values of myPins array to the serial monitor:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;for(int i = 0; i &lt;&gt;&lt;div&gt;Serial.print(myPins[i]);&lt;/div&gt;&lt;div&gt;Serial.print(", ");&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;Serial.println();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This snippet of code will display the values with a comma and space between each value and then a line break after the last element has been printed. I recommend that you take a look at the for loop link above. The guys at Arduino have a wonderful description of how the mechanics work.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Lets put it into action so you can see how easy they are to use. Create the circuit below and then upload the following code onto the Arduino.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/_HS79_lZtUkM/TTxhVv-LNNI/AAAAAAAAAK8/FWlZensT-nc/s1600/class3_ledArray_photocell.jpg"&gt;&lt;img src="http://4.bp.blogspot.com/_HS79_lZtUkM/TTxhVv-LNNI/AAAAAAAAAK8/FWlZensT-nc/s400/class3_ledArray_photocell.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5565430265805485266" style="cursor: pointer; width: 400px; height: 281px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;contains code to allow me to not mess styles&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;Using an array of digital pins and a for loop to easily contol LEDs&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; with a mapped value from a photocell&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; As you can see, using arrays and for loops makes your code a lot smaller&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; and easy to change.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; Matt Richard&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; http://idblab.blogspot.com&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int sensorPin = A0;    // select the input pin for the potentiometer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int ledPins[] = {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  2, 3, 4, 5, 6, 7, 8, 9, 10, 11};&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  //how to write with out an array&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin1 = 2;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin2 = 3;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin3 = 4;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin4 = 5;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin5 = 6;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin6 = 7;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin7 = 8;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin8 = 9;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin9 = 10;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; int ledPin10 = 11;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int sensorValue = 0;  // variable to store the value coming from the sensor&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int minThresh = 580;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;int maxThresh = 870;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;void setup() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  Serial.begin(9600);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  for(int i = 0; i &lt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    pinMode(ledPins[i], OUTPUT); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  /*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  //how to write with out for loop&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin1,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin2,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin3,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin4,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin5,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin6,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin7,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin8,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin9,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   pinMode(ledPin10,OUTPUT);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // read the value from the sensor:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  sensorValue = analogRead(sensorPin);    &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  Serial.println(sensorValue);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  controlLEDs();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;void controlLEDs(){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  int numLEDsOn = map(sensorValue, minThresh, maxThresh, 0, 10);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  for(int i = 0; i &lt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins[i], HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  for(int j = numLEDsOn; j &lt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins[j], LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  /*&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  // how to write without for loops and arrays&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 0){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 1){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 2){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;   if(numLEDsOn == 0){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 3){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 4){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 5){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, LOW);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 6){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 7){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 8){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 9){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, LOW); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  if(numLEDsOn == 10){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins1, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins2, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins3, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins4, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins5, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins6, HIGH);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins7, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins8, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins9, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;    digitalWrite(ledPins10, HIGH); &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;  */&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;unless the resulting number would be less than 0.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-9016539721489976414?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/9016539721489976414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/01/todays-class-is-going-to-be-exciting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/9016539721489976414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/9016539721489976414'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/01/todays-class-is-going-to-be-exciting.html' title='Physical Computing with Arduino: class 3'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_HS79_lZtUkM/TTMo7PqhbMI/AAAAAAAAAJ0/kmWn7dCedK4/s72-c/class2_led_pwm.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-6201750116401894489</id><published>2011-01-15T17:53:00.026-05:00</published><updated>2011-01-22T20:28:25.385-05:00</updated><title type='text'></title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;Here is the agenda for class 2:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;1.&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Soldering (lab)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; 2&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Comment (code) - review from last week&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; 3&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Variables (code) - add to what we learned last week&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; 4&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Program structure (code) - add to what we learned last week&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; 5&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;PWM - introduction to Pulse Width Modulation&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; 6&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Fading using timer (lab)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; 7&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Where to find components/tools/cool stuff&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Soldering:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Soldering is simple in concept but takes some practice to become proficient. Before you begin soldering you will first need the necessary tools: &lt;a href="http://www.radioshack.com/product/index.jsp?productId=2062728"&gt;soldering iron&lt;/a&gt;, &lt;/span&gt;&lt;a href="http://www.sparkfun.com/products/10241"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;solder&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; and a &lt;a href="http://www.allproducts.com/manufacture98/fima/product3.jpg"&gt;copper scrubber&lt;/a&gt;. Some additional tools to mention are: &lt;a href="http://www.radioshack.com/product/index.jsp?productId=2049774"&gt;solder flux&lt;/a&gt;, &lt;a href="http://www.radioshack.com/product/index.jsp?productId=3928375"&gt;helping hands&lt;/a&gt;, and a &lt;a href="http://www.radioshack.com/product/index.jsp?productId=2062745"&gt;solder vacuum&lt;/a&gt;. Out of all of the tools, having great solder and a nice clean tip on your iron will be the biggest help.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Soldering breaks down to a few simple steps. First, apply a beat of solder to the tip of a hot iron. This is called tinning the tip and will allow for easier transfer of heat between the tip and the metals to be soldered together. Next, apply the tip to the contacts(metal part of the component/wire to be soldered) and allow the metals to heat for a second or three. Now place the solder onto the contacts and wait for the solder to flow onto the metal. If done properly the solder will hug close to the contacts, you will know when it happens and it is spectacular. It took me a few hours of soldering to really get the hang of the it.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;By far the most difficult part of soldering is juggling all of the components and tools. Two ways to help with this problem are to use a breadboard to hold the components or use helping hands. Using the breadboard is perfect for soldering &lt;a href="http://www.adafruit.com/index.php?main_page=product_info&amp;amp;cPath=42&amp;amp;products_id=264"&gt;breakout boards&lt;/a&gt;, boards made to have a component interface with a breadboard, but not as good as helping hands at most other soldering applications. One trick my friend &lt;a href="http://www.fridgebuzzz.com/"&gt;Paul Rothman&lt;/a&gt; taught me was to use the helping hands to hold the solder instead of holding the components. This works if you can easily hold both components with one hand and the iron with the other.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;There are tons of tutorials online that show you detailed examples of all types of soldering. I have embedded a great beginner video for reference.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;object width="480" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/BLfXXRfRIzY?fs=1&amp;amp;hl=en_US"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/BLfXXRfRIzY?fs=1&amp;amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Commenting  (code):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Commenting code is an important part of making sense of what is going on in the code, especially when you come back to your program at a later date.  Using comments, you can leave descriptions of the processes and variables used in your program. There are two kinds of commenting, line commenting(//...) and block comments(/*...*/). &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Line commenting occurs each time you place two forward slashes in your code. The rest of the text on the line with the slashes is disregarded by the compiler. This is a great way to turn off one line of code but still have it available for a later time.  &lt;/span&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;Block comments use a combination of */ to begin the comment and */ to end the comment. Anything inside of those characters will be disregarded by the compiler. This allows you to turn off big chunks of code and create proper code descriptions.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  Blink&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  Turns on an LED on for one second, then off for one second, repeatedly.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  This example code is in the public domain.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; */&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void setup() {                &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // initialize the digital pin as an output.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // Pin 13 has an LED connected on most Arduino boards:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  pinMode(13, OUTPUT);     &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  digitalWrite(13, HIGH);   // set the LED on&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  delay(1000);              // wait for a second&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  digitalWrite(13, LOW);    // set the LED off&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  delay(1000);              // wait for a secon&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style=" color: rgb(255, 153, 102); "&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;d&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style=" color: rgb(255, 153, 102); "&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Variables  (code):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Variables are a way of storing and accessing values in programming. There are many different types of variables, each type has a limit to how big of a number or even what type of number can be stored inside. So far we have only used integers(int) in our code. An integer is a whole number with a range from -32,768 to 32,767. Today we will learn about floats, a number with a floating point or decimal. Floats are great for fine detail in rate of change as they allow us to have access to the numbers between whole numbers.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;As we progress in class we will learn and use more variable types. If you want to learn more ahead of time you can check out the &lt;a href="http://arduino.cc/en/Reference/HomePage"&gt;variables column&lt;/a&gt; on the Arduino website.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Program Structure  (code):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  Smoothing&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  Reads repeatedly from an analog input, calculating a running average&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  and printing it to the computer.  Keeps ten readings in an array and &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  continually averages them.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  The circuit:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;    * Analog sensor (potentiometer will do) attached to analog input 0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  Created 22 April 2007&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  By David A. Mellis  &lt;dam@mellis.org&gt;&lt;/dam@mellis.org&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  http://www.arduino.cc/en/Tutorial/Smoothing&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  This example code is in the public domain.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;*/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// Define the number of samples to keep track of.  The higher the number,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// the more the readings will be smoothed, but the slower the output will&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// respond to the input.  Using a constant rather than a normal variable lets&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;// use this value to determine the size of the readings array.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;const int numReadings = 10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int readings[numReadings];      // the readings from the analog input&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int index = 0;                  // the index of the current reading&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int total = 0;                  // the running total&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int average = 0;                // the average&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int inputPin = A0;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66FF99;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void setup()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66FF99;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66FF99;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // initialize serial communication with computer:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66FF99;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  Serial.begin(9600);                   &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66FF99;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // initialize all the readings to 0: &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66FF99;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  for (int thisReading = 0; thisReading &lt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66FF99;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;    readings[thisReading] = 0;          &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66FF99;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void loop() {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // subtract the last reading:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  total= total - readings[index];         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // read from the sensor:  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  readings[index] = analogRead(inputPin); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // add the reading to the total:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  total= total + readings[index];       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // advance to the next position in the array:  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  index = index + 1;                    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // if we're at the end of the array...&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  if (index &gt;= numReadings)              &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;    // ...wrap around to the beginning: &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;    index = 0;                           &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // calculate the average:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  average = total / numReadings;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  // send it to the computer (as ASCII digits) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  Serial.println(average, DEC);               &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;It is important to have a standard structure when writing a program. A structure will make it easy for you and others to locate all of the components of your program.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;The first part of the program should be a &lt;span class="Apple-style-span"  style="color:#FF6666;"&gt;description&lt;/span&gt; of what the program is using block comments.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;The second section is where you place all of your &lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;variables&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;.  Start with constants first and then group them according to their purpose. Don't forget to leave detailed comments.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;The third section is for the &lt;span class="Apple-style-span"  style="color:#66FF99;"&gt;setup() function&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;. Void setup() is where you initialize your digital pins and communication lines.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;The fourth section is for the &lt;span class="Apple-style-span"  style="color:#66CCCC;"&gt;loop() function&lt;/span&gt;. Void loop() is what gets executed by the microcontroller on every loop or frame. This will get repeated over and over until the microcontroller is turned off.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:georgia;"&gt;The fifth section(not depicted) is used for functions you create.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;PWM - introduction to Pulse Width Modulation:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Pulse Width Modulation is a process of taking a digital pin(on/off) and creating a gradient value or change. By pulsing the pin on and off in varying square waves you can achieve a range of values which can be used to "dim" an LED. I say "dim" because really the LED is being turned on and off so fast that our eyes perceive it as dim.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Fading using timer (lab):&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;&lt;a href="http://3.bp.blogspot.com/_HS79_lZtUkM/TTMo7PqhbMI/AAAAAAAAAJ0/kmWn7dCedK4/s1600/class2_led_pwm.jpg"&gt;&lt;img src="http://3.bp.blogspot.com/_HS79_lZtUkM/TTMo7PqhbMI/AAAAAAAAAJ0/kmWn7dCedK4/s400/class2_led_pwm.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5562834963014970562" style="cursor: pointer; width: 400px; height: 281px; " /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style=" ;font-family:Georgia, serif;"&gt;&lt;a href="http://1.bp.blogspot.com/_HS79_lZtUkM/TTMpocPCdgI/AAAAAAAAAJ8/5HMWIs4SuR4/s1600/class2_RGBled_pwm.jpg"&gt;&lt;img src="http://1.bp.blogspot.com/_HS79_lZtUkM/TTMpocPCdgI/AAAAAAAAAJ8/5HMWIs4SuR4/s400/class2_RGBled_pwm.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5562835739483469314" style="cursor: pointer; width: 400px; height: 281px; " /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;/*&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;PWM LED&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;dim an led using analogWrite&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;code by Matt Richard&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;*/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pinRed = 11;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmValueRed = 0;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmIncrementRed = 1;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pinGreen = 3;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmValueGreen = 0;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmIncrementGreen = 2;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pinBlue = 6;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmValueBlue = 0;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmIncrementBlue = 3;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmMin = 0;// the lowest pwm value - 0 = off&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;int pwmMax = 255;// the highest pwm value - 255 = full on&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void setup(){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; Serial.begin(9600); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void loop(){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  red();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  green();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  blue();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  delay(20);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void red(){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; pwmValueRed = pwmValueRed + pwmIncrementRed;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; Serial.println(pwmValueRed);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; // pwmValue += pwmIncrement;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; // this takes care of the pwmValue being smaller than pwmMin&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; if(pwmValueRed &lt;= pwmMin){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   Serial.println("we reached red's bottom!");&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmIncrementRed = pwmIncrementRed * -1;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmValueRed = pwmValueRed + pwmIncrementRed;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; // this takes care of the pwmValue being larger than pwmMax&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; if(pwmValueRed &gt;= pwmMax){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   Serial.println("we reached red's top!");&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmIncrementRed = pwmIncrementRed * -1;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmValueRed = pwmValueRed + pwmIncrementRed;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  analogWrite(pinRed, pwmValueRed); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void green(){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; pwmValueGreen = pwmValueGreen + pwmIncrementGreen;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; Serial.println(pwmValueGreen);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; // pwmValue += pwmIncrement;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; // this takes care of the pwmValue being smaller than pwmMin&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; if(pwmValueGreen &lt;= pwmMin){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   Serial.println("we reached Green's bottom!");&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmIncrementGreen = pwmIncrementGreen * -1;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmValueGreen = pwmValueGreen + pwmIncrementGreen;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; // this takes care of the pwmValue being larger than pwmMax&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; if(pwmValueGreen &gt;= pwmMax){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   Serial.println("we reached Green's top!");&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmIncrementGreen = pwmIncrementGreen * -1;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmValueGreen = pwmValueGreen + pwmIncrementGreen;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  analogWrite(pinGreen, pwmValueGreen); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;void blue(){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; pwmValueBlue = pwmValueBlue + pwmIncrementBlue;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; Serial.println(pwmValueBlue);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; // pwmValue += pwmIncrement;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; // this takes care of the pwmValue being smaller than pwmMin&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; if(pwmValueBlue &lt;= pwmMin){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   Serial.println("we reached Blue's bottom!");&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmIncrementBlue = pwmIncrementBlue * -1;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmValueBlue = pwmValueBlue + pwmIncrementBlue;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; // this takes care of the pwmValue being larger than pwmMax&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; if(pwmValueBlue &gt;= pwmMax){&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   Serial.println("we reached Blue's top!");&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmIncrementBlue = pwmIncrementBlue * -1;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;   pwmValueBlue = pwmValueBlue + pwmIncrementBlue;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  analogWrite(pinBlue, pwmValueBlue); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="color:#FF9966;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Where to find components/tools/cool stuff:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Do to the change in culture here in America, hobbyist electronics is not as common as it once was. If you want to walk to a store to purchase electronic components your only option is likely to be Radio Shack. Radio Shack has an assortment of resistors and capacitors as well as a few IC(intergraded circuits). If you want a much better selection and lower cost, you will need to look online. Here is a list of some great electronics suppliers that I like.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Electronics:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;a href="http://www.sparkfun.com/"&gt;SparkFun&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;a href="http://www.adafruit.com/"&gt;Adafruit&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;a href="http://evilmadscience.com/directory"&gt;Evil Mad Science&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;a href="http://www.macetech.com/store/"&gt;MaceTech&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;a href="http://www.goldmine-elec.com/"&gt;Electronics Goldmine&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;a href="http://www.jameco.com/webapp/wcs/stores/servlet/StoreCatalogDisplay?storeId=10001&amp;amp;catalogId=10001&amp;amp;langId=-1&amp;amp;rfr=1"&gt;Jameco&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.mouser.com/"&gt;Mouser&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Robotics:&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.pololu.com/"&gt;Pololu&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.lynxmotion.com/"&gt;LynxMotion&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hardware/Materials:&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.smallparts.com/"&gt;SmallParts&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.mcmaster.com/"&gt;McMaster Carr&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-6201750116401894489?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/6201750116401894489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/01/here-is-agenda-for-class-2-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6201750116401894489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6201750116401894489'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/01/here-is-agenda-for-class-2-1.html' title=''/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_HS79_lZtUkM/TTMo7PqhbMI/AAAAAAAAAJ0/kmWn7dCedK4/s72-c/class2_led_pwm.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-6693900302754078181</id><published>2011-01-15T15:47:00.003-05:00</published><updated>2011-01-15T16:05:45.335-05:00</updated><title type='text'>Physical Computing with Arduino: class 1</title><content type='html'>A friend of mine recommended that I use my blog to post class information instead of using google docs. For now I will just include a link to the google presentation for class 1 and will port it over to the blog in the next few days.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="https://docs.google.com/present/edit?id=0ASgbrZT8K6vZZGRobTU0NTVfNGhyaGNndmd2&amp;amp;hl=en"&gt;Class 1 presentation&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-6693900302754078181?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/6693900302754078181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2011/01/physical-computing-with-arduino-class-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6693900302754078181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6693900302754078181'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2011/01/physical-computing-with-arduino-class-1.html' title='Physical Computing with Arduino: class 1'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-3856393454367186512</id><published>2010-03-30T14:39:00.004-04:00</published><updated>2010-03-30T15:32:25.962-04:00</updated><title type='text'>Cute/Monstrous: an exploration into the Fly</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_HS79_lZtUkM/S7JRhwyPi0I/AAAAAAAAAJg/hXEBGWZAwbk/s1600/fly_monstrous.jpg" style="text-decoration: none;"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 259px; height: 320px;" src="http://3.bp.blogspot.com/_HS79_lZtUkM/S7JRhwyPi0I/AAAAAAAAAJg/hXEBGWZAwbk/s320/fly_monstrous.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5454511739172260674" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HS79_lZtUkM/S7JRamEJF0I/AAAAAAAAAJY/0S-NoNrTRdk/s1600/fly_cute.jpg"&gt;&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HS79_lZtUkM/S7JRamEJF0I/AAAAAAAAAJY/0S-NoNrTRdk/s1600/fly_cute.jpg" style="text-decoration: none;"&gt;&lt;img style="text-align: left;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 232px; height: 320px; " src="http://4.bp.blogspot.com/_HS79_lZtUkM/S7JRamEJF0I/AAAAAAAAAJY/0S-NoNrTRdk/s320/fly_cute.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5454511616035460930" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have chosen the fly as my animal to research and create works with for the rest of the semester in Animals, People, and those in between. Each student is required to select an animal from Reaktion's animal series. The books offer a unique look into the lives of familiar, albeit misunderstood, animals. It was a hard choice between crocodiles, which feature prominently in my anxiety dreams, and flies, which I think are very beautiful when seen up close. I chose the fly because, well, they are such close partners to humans yet we rarely think of them as pets except for maybe Pigpen in "Peanuts" or that crazy character from "Midnight in the Garden of Good and Evil" who had flies on strings as companions. We consider them to be harbingers of disease, but really they are just moving our own germs between us. Long story short, I found them fascinating and close to home.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For our first assignment we had to portray our animal in two contrasting ways: monstrous and cute. For cute I used the principles of anthropomorphication to liken a fly to a child. I increased the size of the head, gave it humanesque hands with thumbs and a baseball cap and boots. A button nose, small smile, big eyes and a coy wave topped it off.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For the monstrous image I played more with the horror of a human body being decomposed by flies. When I was a child I found my neighbors dead cat in the woods behind my house. For a moment I believed the creature was still alive because the chest cavity was still in motion. That was when I noticed that the belly had burst open and maggots were roiling inside causing the carcass to undulate rhythmically. I immediately grasped my chest throat with the tips of my fingers pressing deep and hard into my skin, so as to cause pain and make me realize I was alive. But I couldn't help feel like I would eventually end up like that, one day I would be as that cat. The drawing I created focussed on overly defined form as a way to introduce darkness into the piece and also detail, thus keeping the viewers eyes moving. The human form has been warped and skewed to suggest internal changes due to internal decomposition. A hole has been placed in the chest from which flies are being born, quiet similar to our own birth except, flies seem to be born from death and decay which has likely added to there stigma. I even added the beginning of fly wings where the human arm should be to illustrate the change in domain and repurposing of the flesh.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-3856393454367186512?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/3856393454367186512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2010/03/cutemonstrous-exploration-into-fly.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3856393454367186512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3856393454367186512'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2010/03/cutemonstrous-exploration-into-fly.html' title='Cute/Monstrous: an exploration into the Fly'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_HS79_lZtUkM/S7JRhwyPi0I/AAAAAAAAAJg/hXEBGWZAwbk/s72-c/fly_monstrous.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-8195298683205678843</id><published>2010-03-11T17:43:00.002-05:00</published><updated>2010-03-11T17:59:29.538-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LEDs'/><category scheme='http://www.blogger.com/atom/ns#' term='conductive circuit'/><category scheme='http://www.blogger.com/atom/ns#' term='the softness of things'/><title type='text'>Conductive Liquid</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm3.static.flickr.com/2777/4425681992_aa3a97d24d.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 500px; height: 375px;" src="http://farm3.static.flickr.com/2777/4425681992_aa3a97d24d.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm3.static.flickr.com/2683/4424301543_202ce8f8e0.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 500px; height: 375px;" src="http://farm3.static.flickr.com/2683/4424301543_202ce8f8e0.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm5.static.flickr.com/4072/4424298271_c72dbd60f9.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 500px; height: 375px;" src="http://farm5.static.flickr.com/4072/4424298271_c72dbd60f9.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;Elie Zananiri and I decided to make a fluid that would allow us to create liquid circuits. We tried many different combinations of the materials: water, oil, salt, powder graphite, and glue. The best combination was water, salt, and graphite, which resulted in a mixture that gave a steady reading of about 100 ohms. We used the liquid to create both a drawn circuit and an irrigation circuit.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;object width="640" height="480"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=10096351&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=10096351&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="640" height="480"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&lt;a href="http://vimeo.com/10096351"&gt;Conductive Fluid Drawing&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;object width="640" height="480"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=10096542&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=10096542&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="640" height="480"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&lt;a href="http://vimeo.com/10096542"&gt;Conductive fluid irrigation LED circuit&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-8195298683205678843?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/8195298683205678843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2010/03/conductive-liquid.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/8195298683205678843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/8195298683205678843'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2010/03/conductive-liquid.html' title='Conductive Liquid'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2777/4425681992_aa3a97d24d_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-6106369796005005245</id><published>2010-03-04T16:07:00.004-05:00</published><updated>2010-03-04T16:30:53.149-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='the softness of things'/><title type='text'>Teach-Shirt</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HS79_lZtUkM/S5AmY7aidtI/AAAAAAAAAIw/f7E_h6tUja8/s1600-h/Teach-shirt.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 76px; height: 200px;" src="http://4.bp.blogspot.com/_HS79_lZtUkM/S5AmY7aidtI/AAAAAAAAAIw/f7E_h6tUja8/s200/Teach-shirt.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5444894159198648018" /&gt;&lt;/a&gt;&lt;br /&gt;A concern of mine for the developing world is how to deliver teaching materials. I had an idea for t-shirts that have information printed on them in a way that makes it viewable while being worn. This way the person could study randomly through out the day. The shirts could have printing on all 4 sides: front, back, inside front, inside back. Each side would have a different subject matter, perhaps mathematics, science, history, and art. The teachings would be designed for each specific area to which they were distributed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-6106369796005005245?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/6106369796005005245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2010/03/teach-shirt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6106369796005005245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6106369796005005245'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2010/03/teach-shirt.html' title='Teach-Shirt'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_HS79_lZtUkM/S5AmY7aidtI/AAAAAAAAAIw/f7E_h6tUja8/s72-c/Teach-shirt.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-3577031744653452497</id><published>2010-02-09T15:58:00.010-05:00</published><updated>2010-02-23T16:06:12.326-05:00</updated><title type='text'>The faces of pigs in human representation</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.aucoeurdelaplanete.com/Mythologie/ANIMAL/Fenrir-Garm-Gullinbursti-Slidrugtanni/Gullinbursti.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 250px; height: 352px;" src="http://www.aucoeurdelaplanete.com/Mythologie/ANIMAL/Fenrir-Garm-Gullinbursti-Slidrugtanni/Gullinbursti.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style=" line-height: 19px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;"...to Freyr he gave the boar, saying that it could run through air and water better than any horse, and it could never become so dark with night or gloom of the Murky Regions that there should not be sufficient light where he went, such was the glow from its mane and bristles..."&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman', serif;"&gt;&lt;span class="Apple-style-span"  style=" line-height: 19px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;In Norse mythology the boar &lt;/span&gt;&lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/Gullinbursti"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;Gullinbursti&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;, is a magical creature created in a blacksmiths furnace as a bet that it could not be done. He is a symbol of strength, intelligence, and courage. He is shown in the illustration behind his owner &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style=" line-height: 19px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;Freyr, god of farming, peace, and sexual pleasure. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 19px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style=" line-height: 19px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;Here is a &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;Belgian&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt; children's cartoon depicting a pig as a gross and funny farting pig. The pig is full of life, full of humor, and seems to be a help, but ends up just causing a mess. This is the typical western depiction of a pig, not very bright and full of smelly farts. This depiction is most likely a result of the way pigs are raised/farmed in our culture. Many pigs are kept in small areas, resulting in huge amounts of animal waste and a putrid smell to boot. They are often portrayed rolling in there own waste or mud which only adds to our image of them as a dirty and stupid animal.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docid=8297574364836044520&amp;amp;hl=en&amp;amp;fs=true" style="width:400px;height:326px" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash"&gt;&lt;/embed&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;This &lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.davickservices.com/monster_pig_of_clay_county.htm"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;pig&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt; is depicted as a monster that needed to be cruelly shot down by an 11 year old boy. The alleged giant was from the the back woods of South Georgia, and was shot 8 times with a 50-caliber hand gun! &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 600px; height: 406px;" src="http://www.davickservices.com/Monster%20Pig%20Clay%20County%20Alabama.jpg" border="0" alt="" /&gt;&lt;span class="Apple-style-span" style="line-height: 19px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;&lt;span class="Apple-style-span" style=" line-height: normal; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 19px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;&lt;span class="Apple-style-span" style=" line-height: normal; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; "&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;Gullinbursti is a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt; depiction of a pig that is very different from how I was raised to think of a pig, so much so that I find the illustration rather bizarre. The idea of a sacred powerful pig defies the idea of a dirty, smelly pig that I was raised to have as an idea. The last depiction of the monster pig is just sad to me. To me this is an honorable champion of the woods, most likely a stray pig that survived very well, and a giant of the world. I guess the part that truly saddens me is that people feel proud to destroy the giants of the world.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-3577031744653452497?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/3577031744653452497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2010/02/faces-of-pigs-in-human-representation.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3577031744653452497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3577031744653452497'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2010/02/faces-of-pigs-in-human-representation.html' title='The faces of pigs in human representation'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-6007703216231677243</id><published>2010-01-26T14:53:00.003-05:00</published><updated>2010-01-26T15:25:03.713-05:00</updated><title type='text'>My animal self portrait</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_HS79_lZtUkM/S19I3t2OF9I/AAAAAAAAAIg/66na4fTiyzc/s1600-h/beaver5.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 248px;" src="http://2.bp.blogspot.com/_HS79_lZtUkM/S19I3t2OF9I/AAAAAAAAAIg/66na4fTiyzc/s400/beaver5.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5431139797669124050" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For my first assignment in Animals, People and those in between I was instructed to create a portrait of my animal self, or spirit animal. By this I mean, an animal to which I feel a certain kinship or that we share similar traits in both habit, habitat, and personality. I happen to have always loved animals, and have a large knowledge of many species both foreign and domestic, so this was a bit of a daunting task, or so I thought. Frankly, the American Beaver (&lt;span class="Apple-style-span" style="font-family: sans-serif, serif; font-size: 13px; font-style: italic; font-weight: bold; line-height: 19px; "&gt;Castor canadensis)&lt;span class="Apple-style-span" style="font-family: Georgia, serif; font-size: 16px; font-style: normal; font-weight: normal; line-height: normal; "&gt; came to me rather quickly and while I would like to think we do not share a lot of physical characteristics, I do think we are quite similar in many ways.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Well for starters I feel that I am a builder at heart and at practice and the beaver is undeniably a prolific builder. The beaver also has a larger than body personality, which is reflected in the effects his/her building has on the world around it. I would like to think that my creations influence those around me in mostly positive ways, similar to the way the beaver can create new bodies of water for new life to grow( a little sappy ). I have always felt at home in the water in a way that makes me dream in swimming, and I love splashing. I also associate myself with the fact the beaver can be prey. What I mean by this is that the beaver is a very alert individual and I have always been alert of my surroundings, relying more on my awareness than on my strength.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I chose to place the beaver in the environment of the Strip Mall construction site by the road for a lot of reasons that relate to how I feel and how I relate to my past. No matter how hard I try, I still feel like I am a transient New Yorker and that my true home is Northern Virginia. Recently I have come to the opinion that "NoVa would be a great place, if you would just get rid of the people", but that is not entirely true. I grew up with constant construction and remodeling in NoVa, whether it was roads or shopping malls, it was always changing, and so I felt it was appropriate to include some sort of construction in a self portrait. But everyone knows that a construction site is not the ideal place for a beaver, and this relates to how I feel about the lack of nature I experience in New York. Yet, I can't help but feel a similarity between the beaver and its damn and the construction site and its shopping mall. Both are considered pests and blights on the landscape but they do a lot to bring life to an area.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-6007703216231677243?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/6007703216231677243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2010/01/my-animal-self-portrait.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6007703216231677243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6007703216231677243'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2010/01/my-animal-self-portrait.html' title='My animal self portrait'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_HS79_lZtUkM/S19I3t2OF9I/AAAAAAAAAIg/66na4fTiyzc/s72-c/beaver5.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-8026429165242068962</id><published>2009-11-16T10:26:00.011-05:00</published><updated>2009-11-16T18:47:11.015-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Rest of You'/><category scheme='http://www.blogger.com/atom/ns#' term='HRM'/><category scheme='http://www.blogger.com/atom/ns#' term='GSV'/><title type='text'>Stress Computing: Keeping track of stress before it tracks YOU down and KILLS you!</title><content type='html'>Stress is big business these days. Whether you are concerned with relieving stress, preventing stress, or monitoring stress you are sure to find plenty of products that claim to help you get to the bottom of the whole stressful stress stuff. But what exactly is stress and why are so many people concerned with it?&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/General_Adaptation_Syndrome.jpg/300px-General_Adaptation_Syndrome.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 300px; height: 219px;" src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/General_Adaptation_Syndrome.jpg/300px-General_Adaptation_Syndrome.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;blockquote&gt;Stress is a biological term for the consequences of the failure of a human or animal to respond appropriately to emotional or physical threats to the organism, whether actual or imagined. It includes a state of alarm and adrenaline production, short-term resistance as a coping mechanism, and exhaustion. Common stress symptoms include irritability, muscular tension, inability to concentrate and a variety of physical reactions, such as headaches and elevated heart rate.&lt;br /&gt;&lt;br /&gt;It covers a huge range of phenomena from mild irritation to the kind of severe problems that might result in a real breakdown of health. Signs of stress may be cognitive, emotional, physical or behavioral. Signs include poor judgment, a general negative outlook, excessive worrying, moodiness, irritability, agitation, inability to relax, feeling lonely or isolated, depressed, aches and pains, diarrhea or constipation, nausea, dizziness, chest pain, rapid heartbeat, eating too much or not enough, sleeping too much or not enough, withdrawing from others, procrastinating or neglecting responsibilities, using alcohol, cigarettes, or drugs to relax, and nervous habits (e.g. nail biting or pacing).&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;This is how stress effects the body in the relative short term, but what about common causes of stress and long term stress exposure?&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;So, here’s the top 7 Greatest Stress-creating behaviors. Find the ones that apply to you, and get to eliminating them, because these you can control.&lt;br /&gt;&lt;br /&gt;1. Not saying “no”:&lt;br /&gt;This is a particular problem for the female of the species, but men, now even you're doing it. It’s OK, in fact it’s healthy to turn down a request from family or friends, or not volunteer for that PTA project when you’re already looking for time on your schedule to eat... Take Nancy Reagan’s advice and…”just say NO” – nicely and with a brief, honest explanation (“I’m just too booked right now” or “my kids come first and I’m not spending enough time with them as it is…”) Only you can prevent over-load fires.&lt;br /&gt;&lt;br /&gt;2. Inefficient time/task management:&lt;br /&gt;Set a schedule for checking/responding to emails and voice messages, vs. doing so extensively throughout the day; this technique is used by the top business leaders. When scheduling an appointment, rather than asking “what time’s good for you?” which gives away control of your schedule, start by giving them some good times for you. Pay attention to the amount of time it takes you to complete a task, get to/from a meeting etc; you’ll be amazed by how much longer these things take than you thought, and now you can arrange your schedule more realistically.&lt;br /&gt;&lt;br /&gt;3. Being a perpetual “fixer”:&lt;br /&gt;Take off the Knight suit and stop rescuing people. It’s an unhealthy way to get attention, and, honestly, you’re really helping yourself more than actually helping them (it’s called “enabling”). If it is your responsibility, know what is in and out of your control so you don’t spin your wheels working on things that you cannot possibly influence.&lt;br /&gt;&lt;br /&gt;4. Not scheduling time for rejuvenation:&lt;br /&gt;Burn out is guaranteed when you don’t make taking time to rest/rejuvenate as much a part of your schedule as getting the laundry done. It is not something that you can take or leave – it is a mandatory requirement for both your body and your mind, and ignoring that law of physics will not change it.&lt;br /&gt;&lt;br /&gt;5. No exercise:&lt;br /&gt;The human body requires regular physical movement much like an automobile requires regular running to maintain it in good working order. You cannot remain sedentary and expect to feel good. Change your daily habits from using the least amount of physical exertion to using the most (taking the stairs whenever possible, walking into the bank vs. using the drive-thru, etc.), or you purchase one a large work-out ball to use at home, particularly while watching TV (good for everything from sit-ups to leg strengthening), But, keep your personal “vehicle” sitting in the proverbial driveway and you will soon be taking it to the salvage lot….&lt;br /&gt;&lt;br /&gt;6. Making “mountains out of molehills”:&lt;br /&gt;Otherwise and more currently known as “sweating the small stuff”, This behavior is quite toxic for you, and a real relationship buster with those you love. Learn to discern the difference between what’s truly important and worthy of concern, and what’s worthy of a smile, a shrug, and moving on. Begin by getting feed-back (from people whose opinion you trust) on when you tend to do this most often, and start with those and similar situations.&lt;br /&gt;&lt;br /&gt;7. “Should’ing” all over yourself (and others…):&lt;br /&gt;I think “should” shouldn’t be in the dictionary… I mean, really, what does “should” actually indicate? “I should be better at that….” Huh?! Either you can be better at that or you can’t (for whatever clear reason); you will be better at that or you won’t (depending on your level of motivation or present capabilities). Thinking “should” is a set-up for a no-win; an expectation with no clear determination of whether the desired outcome is doable in actuality. Be clear about what you or others actually “can” or “won’t” do vs. what they “should” do, and you’ll be on much more solid ground.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;As for the long term effects of stress...&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Stress can significantly affect many of the body's immune systems, as can an individual's perceptions of, and reactions to, stress. The term psychoneuroimmunology is used to describe the interactions between the mental state, nervous and immune systems, as well as research on the interconnections of these systems. Immune system changes can create more vulnerability to infection, and have been observed to increase the potential for an outbreak of psoriasis for people with that skin disorder.&lt;br /&gt;&lt;br /&gt;Chronic stress has also been shown to impair developmental growth in children by lowering the pituitary gland's production of growth hormone, as in children associated with a home environment involving serious marital discord, alcoholism, or child abuse.&lt;br /&gt;&lt;br /&gt;Studies of female monkeys at Wake Forest University (2009) discovered that individuals suffering from higher stress have higher levels of visceral fat in their bodies. This suggests a possible cause-and-effect link between the two, wherein stress promotes the accumulation of visceral fat, which in turn causes hormonal and metabolic changes that contribute to heart disease and other health problems.&lt;br /&gt;&lt;br /&gt;Over the long term, distress can lead to diminished health and/or increased propensity to illness; to avoid this, stress must be managed.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Great! We already have so many things to worry about these days(ever increasing our stress levels), now we have to worry about too much stress. How much of stress monitoring can be done autonomously by a wearable device, or does the psychological nature of stress require a higher self awareness for effective monitoring/management? Quite a few companies tout wonder devices that aim to monitor and then help alleviate stress, but what exactly do they monitor and do they work at relieving stress?&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ece.uah.edu/~jovanov/papers/Jovanov_EMBS03.pdf"&gt;Full Body Stress Monitor&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.firstbeat.fi/index.php?page=93"&gt;Firstbeat HEALTH: heartbeat monitor&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.futurehealth.org/populum/pagesimple.php?f=Bio-q-Thermal-Biofeedback-And-Stress-Mon-284"&gt;Bio-Q Ring&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-8026429165242068962?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/8026429165242068962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/11/stress-computing-keeping-track-of.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/8026429165242068962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/8026429165242068962'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/11/stress-computing-keeping-track-of.html' title='Stress Computing: Keeping track of stress before it tracks YOU down and KILLS you!'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-751691774002657460</id><published>2009-11-09T11:27:00.004-05:00</published><updated>2009-11-23T11:41:06.389-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='The Rest of You'/><category scheme='http://www.blogger.com/atom/ns#' term='Existential Computing'/><title type='text'>An Argument for Existential Computing</title><content type='html'>I think the dedication of attention to details of ones person is good for humanity. I do not think that the integration of computers is necessary to do so. However, I do think that computers allow for us to capture the data we want to pay attention to while not needing to actively participate in the actual logging and sensing of data. That said, the logging of self data should lead the individual to some conclusion about priorities, at which point the person is required to spend time reflecting on the outcome of the data, and ultimately change themselves in a way that better positions them in life. For example, one could log stress data(galvanic skin response and heart rate) while commuting to and from work, trying out different routes and departure times. But if once the data is collected and the person refuses to look at the data or respond appropriately then the logging of data has served no purpose. But this is obvious, I suppose what I am trying to say is that the active participation of the person in reviewing the data is as, if not more, important than the logging of the data. The active participation in reviewing the data conveys a willingness to change ones habits, or a fluidity in the brains make up for change. Why do I think that paying attention to self data is good for humanity? I don't really, what I do think is good is the repositioning of priorities to facilitate happiness in yourself and others. The decision to change ones priorities from quickness of commute to least stressful of commute has implications that will cascade down past the individual. The fundamental decision to value ones personal mental health over ones ability to pack as much into one day as possible also has the effect of restructuring values in other areas of a persons life. Good uses for data logging include times in which the person is under the assumption that an activity is inherently something, and so executes the activity because of the desired outcome, ie. I watch TV when I get home at night to relax. If one were to log data while watching TV after coming home and then log data while doing other activities, one could get a better idea of what is actually relaxing and not just sedating. To a certain extent, paying close attention to data logging allows us as individuals to create new values and let go of old ones given to us by our family, or at least the possibility could arise. But why, what is the reason to spend time reviewing details of your life? From my examples I immediately think of health reasons, less stress has been proven to better on your body and mind. Also, if some how we are all connected and a collective conscious does exists, then I think it is better to have a happy, calm, and caring collective conscious over an angry, nervous, and apathetic collective conscious.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-751691774002657460?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/751691774002657460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/11/argument-for-existential-computing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/751691774002657460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/751691774002657460'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/11/argument-for-existential-computing.html' title='An Argument for Existential Computing'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-2328961485691366545</id><published>2009-10-25T18:06:00.006-04:00</published><updated>2009-12-03T13:37:54.805-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Project Studio'/><title type='text'>Processing Maquette for my light sculpture</title><content type='html'>I am currently working on a 4x4 ft light sculpture for Danny Rozin's "Project Studio" class. The sculpture uses 40 servos to move 40 arms that each have 2 RGB LEDs at the tips. I am most interested in the way the light from the LEDs will mix together on the canvas, especially since I can control both the color of the light and it position. I uploaded a Processing sketch I made to visualize patterns and color sequences. This version focuses on movement patterns and not color. Drag the mouse on the screen to change the viewing angle.&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="400"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7966149&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=7966149&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&lt;a href="http://vimeo.com/7966149"&gt;Estrella Intersects the Plane&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-2328961485691366545?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/2328961485691366545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/10/processing-maquette-for-my-light.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/2328961485691366545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/2328961485691366545'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/10/processing-maquette-for-my-light.html' title='Processing Maquette for my light sculpture'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-4622468135350555382</id><published>2009-10-12T12:50:00.002-04:00</published><updated>2009-10-12T13:10:20.487-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='longboarding'/><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='The Rest of You'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><title type='text'>Foot Sensors for Longboarding Data</title><content type='html'>This week the goal was to make our data logging devises mobile if not wearable. I was unable to become fully detached from my computer for the data logging. However, I was able to make it mobile by using a small netbook to log the data, and keep it stored in my backpack while I went for a nice ride around Washington Square Park. The values were sent from the Arduino via serial communication, and Processing listened for the values and wrote them to a CSV(comma separated values) file. Next, I stuck the file into a program written by Dan O'Sullivan that graphs that data and allows the viewer to scroll through the data. If you look closely, you will see that my right foot makes more jumps than my left foot. This is because I push my longboard with my right foot :) Moving forward, I would like to find a better sensor for a more stable and wider range values. I found that the FSRs that I used were almost maxed out even when standing.&lt;br /&gt;&lt;br /&gt;&lt;iframe width="628" height="480" scrolling="no" frameborder="0" src="http://www.openprocessing.org/visuals/iframe.php?visualID=5237&amp;width=600&amp;height=400"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-4622468135350555382?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/4622468135350555382/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/10/foot-sensors-for-longboarding-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4622468135350555382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4622468135350555382'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/10/foot-sensors-for-longboarding-data.html' title='Foot Sensors for Longboarding Data'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-602421675525362227</id><published>2009-10-09T13:07:00.003-04:00</published><updated>2009-10-09T13:45:02.649-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='The Rest of You'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><title type='text'>Depth Time: adventures in finger painting</title><content type='html'>Sue Syn and I collaborated on a project for Dan O'Sullivan's "The Rest of You" class, in which we wore ultra sonic range finders on our wrists while we painted with our hands. The values that were recorded from the sensors were then used to render information that was captured from a camera that was recording our movements. Both the actual footage and the data augmented video were displayed together. The result is a time lapse record of our movements and color choices, allowing the user to watch the painting develop and time pass. The idea was to make the artist and viewer aware of spatial relationships that are not considered important or taken for granted. The hope being that a greater understanding of one's subconscious might come to light. While I was pleased with the result, I have been making strides toward a better mapping of the depth data than just value. The next iteration of this idea will have the painting pushed and pulled in 3D space based on the values from the range finder.&lt;br /&gt;&lt;br /&gt; &lt;object width="640" height="240"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6685564&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=6685564&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="640" height="240"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;&lt;a href="http://vimeo.com/6685564"&gt;Depth Time&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-602421675525362227?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/602421675525362227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/10/depth-time-adventures-in-finger.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/602421675525362227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/602421675525362227'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/10/depth-time-adventures-in-finger.html' title='Depth Time: adventures in finger painting'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-8732556906107277495</id><published>2009-05-15T01:18:00.004-04:00</published><updated>2009-05-15T01:44:51.989-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computational Cameras'/><category scheme='http://www.blogger.com/atom/ns#' term='computer vision'/><category scheme='http://www.blogger.com/atom/ns#' term='Nature of Code'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenCV'/><title type='text'>Herpes a la Face Tracking</title><content type='html'>For my final in Nature of Code and Computational Cameras, I worked on creating an app that would allow users to take pictures of themselves or their friends. The image is scanned for a face. If a face is detected, simple rules of proportion are used to determine the basic location of the mouth. After the mouth is found, a script that mimics the look and feel of oral herpes is applied to that area of the picture. The resultant image is gross and funny. I also created another version that turns a portrait picture into a mugshot, includes criminal information and a lone teardrop tattoo. Recently I have been doing a lot of image augmentation. I think that it could prove to be very popular if I could only get it out to the masses. Further ideas include, fake family vacation pictures and fake historical pictures. It seems that everyone loves neat pictures of themselves, and frankly, they don't even have to be real.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_HS79_lZtUkM/Sg0BFqbZYII/AAAAAAAAAG8/GSR5CynhyXg/s1600-h/hp.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 300px;" src="http://3.bp.blogspot.com/_HS79_lZtUkM/Sg0BFqbZYII/AAAAAAAAAG8/GSR5CynhyXg/s400/hp.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5335922330304077954" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-8732556906107277495?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/8732556906107277495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/05/herpes-la-face-tracking.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/8732556906107277495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/8732556906107277495'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/05/herpes-la-face-tracking.html' title='Herpes a la Face Tracking'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_HS79_lZtUkM/Sg0BFqbZYII/AAAAAAAAAG8/GSR5CynhyXg/s72-c/hp.png' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-4217050552034474569</id><published>2009-04-13T01:30:00.003-04:00</published><updated>2009-04-13T03:01:34.961-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computational Cameras'/><title type='text'>Camera Futura</title><content type='html'>I was asked to think about the future of cameras and how they will impact or lives. I came up with a few ideas, some more distant then others.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Short Term&lt;/span&gt;&lt;br /&gt;I think image stabilization could easily be improved by allowing the user to hold the shutter button down, but only firing the shutter when an accelerometer in the camera says that the camera is appropriately stable.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Medium Term&lt;/span&gt;&lt;br /&gt;Through advances in image pattern recognition and optimization, new picture taking modes could exist that search for classical balance and proportion. Only when a composition presents itself that includes 20 golden rectangles can an image be captured. This would help amateur photographers better understand the principles of composition.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Long Term&lt;/span&gt;&lt;br /&gt;The ability to compare dimensions, specifically in relation to your body, seems like a useful piece of information to be included in the photo. Which makes me wonder of the future of the photograph itself. In the future cameras will most assuredly capture information in a three dimensional format. Probably through the use of stereoscopic vision like our own eyes. This would weave the extra information into the display rather than simply including it in the Metadata.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-4217050552034474569?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/4217050552034474569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/04/camera-futura.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4217050552034474569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4217050552034474569'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/04/camera-futura.html' title='Camera Futura'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-4936564911289741745</id><published>2009-04-02T00:05:00.005-04:00</published><updated>2009-04-02T00:39:10.471-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computational Cameras'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><category scheme='http://www.blogger.com/atom/ns#' term='color tracking'/><title type='text'>Color Tracking Fun! part 3</title><content type='html'>Back at it with color tracking and the gang. This time are sights are set on driving the streets of NYC in a virtual car. We had several immediate problems that made it impossible to work outside. It began raining and we were using an auto gain webcam which was making our lovely neon pink squares appear white.&lt;br /&gt;&lt;br /&gt;We grabbed a better camera and headed to upper floors of &lt;a href="http://www.tisch.nyu.edu/page/home.html"&gt;Tisch&lt;/a&gt; to shoot in a larger location. The code was riddled with problems and made it nearly impossible to get satisfactory shots. Nevertheless, Winslow had an idea brewing and was able to stitch together a story of a class field trip.&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="270"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3537805&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=3537805&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="270"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/3537805"&gt;Wicked Awesome!!!&lt;/a&gt; from &lt;a href="http://vimeo.com/user850340"&gt;Winslow Porter&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Elffervescence made a debut in the space scene, this time wearing a black background.&lt;br /&gt;&lt;br /&gt;Angela's &lt;a href="http://curiousdevice.com/blog/2009/03/09/pimp-my-ride/"&gt;awesome documentation&lt;/a&gt; again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-4936564911289741745?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/4936564911289741745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/04/color-tracking-fun-part-3.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4936564911289741745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4936564911289741745'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/04/color-tracking-fun-part-3.html' title='Color Tracking Fun! part 3'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-305649876595557169</id><published>2009-04-01T23:39:00.004-04:00</published><updated>2009-04-02T00:43:10.524-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computational Cameras'/><category scheme='http://www.blogger.com/atom/ns#' term='mylo'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><category scheme='http://www.blogger.com/atom/ns#' term='color tracking'/><title type='text'>Color Tracking Fun! part 2</title><content type='html'>The following week we all met again and decided to have a dance party. We invited some of our friends and danced in front of a &lt;a href="http://www.projectorpeople.com/resources/short-throw.asp"&gt;short throw projector&lt;/a&gt; projecting party videos from amongst the ISH. Music by Mylo, "I'm back".&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="267"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3436588&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=3436588&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="267"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/3436588"&gt;MASKPARTY featuring Coconut Horse, ODB, Lemonhead, and Mario&lt;/a&gt; from &lt;a href="http://vimeo.com/user850340"&gt;Winslow Porter&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This time the code was changed to calculate the angle between the two green squares and display the images of various heads onto our bodies. We created a make shift head gear device out of black foam and rubber bands, to which the green squares were attached.&lt;br /&gt;&lt;br /&gt;Another &lt;a href="http://curiousdevice.com/blog/2009/03/02/we-come-from-the-future/"&gt;inside look&lt;/a&gt; by Angela Chen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-305649876595557169?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/305649876595557169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/04/color-tracking-fun-part-2.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/305649876595557169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/305649876595557169'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/04/color-tracking-fun-part-2.html' title='Color Tracking Fun! part 2'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-8112264406734077021</id><published>2009-04-01T22:21:00.007-04:00</published><updated>2009-04-03T18:34:45.244-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computational Cameras'/><category scheme='http://www.blogger.com/atom/ns#' term='a fish this big'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><category scheme='http://www.blogger.com/atom/ns#' term='color tracking'/><title type='text'>Color Tracking Fun!</title><content type='html'>After working with blobs and the OpenCV library to create "Granpa Loves Valentine's Day", Winslow Porter and I combined forces with &lt;a href="http://itp.mjhasson.com/"&gt;Meredith Hasson&lt;/a&gt; and &lt;a href="http://curiousdevice.com/blog/"&gt;Angela Chen&lt;/a&gt; to tackle color tracking.&lt;br /&gt;&lt;br /&gt;Using Dan O’Sullivan's color tracking code as a starting point, we began to develop a simple and &lt;span style="font-style:italic;"&gt;sometimes reliable&lt;/span&gt; way of determining the location of two green squares from the pixel data of a webcam. From the location of each square we can then determine the distance between the squares and even the angle of a line drawn between the two squares.&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3976303&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=3976303&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/3976303"&gt;Gone Fishing Debugging&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;But what to do with such a thing? After a quick brainstorm, the act of fish-story telling, specifically the phrase, "a [fish] this big!" would be captured in augmented video and a simple story would be told.&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="267"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3329936&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=3329936&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="267"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/3329936"&gt;Catch of the Day&lt;/a&gt; from &lt;a href="http://vimeo.com/user850340"&gt;Winslow Porter&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The code can be found &lt;a href="http://curiousdevice.com/blog/2009/02/23/a-tale-of-a-whalefish/"&gt;here&lt;/a&gt; along with an awesome inside look from Angela Chen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-8112264406734077021?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/8112264406734077021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/04/color-tracking-fun.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/8112264406734077021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/8112264406734077021'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/04/color-tracking-fun.html' title='Color Tracking Fun!'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-718641198604874085</id><published>2009-04-01T18:47:00.010-04:00</published><updated>2009-04-02T01:48:36.628-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Nature of Code'/><category scheme='http://www.blogger.com/atom/ns#' term='sketch'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><title type='text'>Rainbow Waves et wake</title><content type='html'>Awhile ago I played around with Dan Shiffman's &lt;a href="http://www.shiffman.net/itp/classes/nature/week04_s09/sine/"&gt;SineWave&lt;/a&gt; processing applet. I only adjusted a few lines of code but was able to create complex patterns. I added a fade by drawing a rectangle over everything at a low transparency. I changed the color mode to HSB(Hue Saturation Brightness). The warping effect of all of the ellipses is because their positions determine their size and color. The striation was created using modulus.&lt;br /&gt;&lt;br /&gt;When I want to show a Processing sketch online I always upload it to &lt;a href="http://www.openprocessing.org/"&gt;OpenProcessing&lt;/a&gt;. This sketch became popular very quickly, which I attribute to an awesome thumbnail. A few weeks after I uploaded Rainbow Waves it was added to the "featured ones", a goal I wanted to achieve since September of 2008.&lt;br /&gt;&lt;br /&gt;&lt;iframe src="http://www.openprocessing.org/visuals/iframe.php?visualID=1012&amp;amp;width=600&amp;amp;height=600" frameborder="0" height="680" scrolling="no" width="628"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;I then created two other sketches shortly thereafter that were inspired by a combination of Rainbow Waves with a &lt;a href="http://www.flickr.com/photos/23463214@N08/"&gt;classmates&lt;/a&gt; homework and color sequencing from the color_tile series I worked on last November.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=1096"&gt;Marios Color Wave&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_HS79_lZtUkM/SdQcyi3NmZI/AAAAAAAAAF0/bfvTyA-tG_I/s1600-h/Marios+Color+Wave.png"&gt;&lt;img style="cursor: pointer; width: 600px; height: 390px;" src="http://2.bp.blogspot.com/_HS79_lZtUkM/SdQcyi3NmZI/AAAAAAAAAF0/bfvTyA-tG_I/s400/Marios+Color+Wave.png" alt="" id="BLOGGER_PHOTO_ID_5319908714508818834" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_HS79_lZtUkM/SdRQ5I_TGtI/AAAAAAAAAGE/VqVEmNBB2xU/s1600-h/Picture+9.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 600px; height: 390px;" src="http://2.bp.blogspot.com/_HS79_lZtUkM/SdRQ5I_TGtI/AAAAAAAAAGE/VqVEmNBB2xU/s400/Picture+9.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5319966002427140818" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=1099"&gt;Elfervescence&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HS79_lZtUkM/SdQdUspXyNI/AAAAAAAAAF8/TU_kz6e0gqk/s1600-h/Elffervescence.png"&gt;&lt;img style="cursor: pointer; width: 600px; height: 390px;" src="http://4.bp.blogspot.com/_HS79_lZtUkM/SdQdUspXyNI/AAAAAAAAAF8/TU_kz6e0gqk/s400/Elffervescence.png" alt="" id="BLOGGER_PHOTO_ID_5319909301250672850" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_HS79_lZtUkM/SdRRRX8mMAI/AAAAAAAAAGM/DLJESb1lcXI/s1600-h/Picture+2.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 600px; height: 390px;" src="http://2.bp.blogspot.com/_HS79_lZtUkM/SdRRRX8mMAI/AAAAAAAAAGM/DLJESb1lcXI/s400/Picture+2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5319966418759200770" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-718641198604874085?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/718641198604874085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/04/rainbow-waves-et-wake.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/718641198604874085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/718641198604874085'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/04/rainbow-waves-et-wake.html' title='Rainbow Waves et wake'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_HS79_lZtUkM/SdQcyi3NmZI/AAAAAAAAAF0/bfvTyA-tG_I/s72-c/Marios+Color+Wave.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-2024126960762968000</id><published>2009-02-26T12:59:00.020-05:00</published><updated>2009-04-02T02:18:09.684-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grossness'/><category scheme='http://www.blogger.com/atom/ns#' term='noise'/><category scheme='http://www.blogger.com/atom/ns#' term='Nature of Code'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><title type='text'>Generative Disease: Cold Sores II</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_HS79_lZtUkM/SabZUhtL7GI/AAAAAAAAAFg/95krXEk_0yI/s1600-h/3.jpg"&gt;&lt;img style="float:left; margin:0 0px 0px 0;cursor:pointer; cursor:hand;width: 300px; height: 200px;" src="http://2.bp.blogspot.com/_HS79_lZtUkM/SabZUhtL7GI/AAAAAAAAAFg/95krXEk_0yI/s320/3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5307168157571214434" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_HS79_lZtUkM/SabZUf4kXsI/AAAAAAAAAFQ/85D9JZf8W9I/s1600-h/1.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 300px; height: 200px;" src="http://2.bp.blogspot.com/_HS79_lZtUkM/SabZUf4kXsI/AAAAAAAAAFQ/85D9JZf8W9I/s320/1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5307168157082083010" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For midterm in Dan Shiffman's Nature of Code, I chose to create &lt;a href="http://www.openprocessing.org/visuals/?visualID=1091"&gt;generative cold sores&lt;/a&gt;. Currently the sores are distributed using Perlin noise. My next step is to incorporate hierarchy into the distribution.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-2024126960762968000?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/2024126960762968000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/02/generative-disease-cold-sores-ii.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/2024126960762968000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/2024126960762968000'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/02/generative-disease-cold-sores-ii.html' title='Generative Disease: Cold Sores II'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_HS79_lZtUkM/SabZUhtL7GI/AAAAAAAAAFg/95krXEk_0yI/s72-c/3.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-4255195382388231215</id><published>2009-02-19T12:35:00.020-05:00</published><updated>2009-04-02T02:07:45.858-04:00</updated><title type='text'>Generative Disease: Cold Sores</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_HS79_lZtUkM/SZ4DuInIOCI/AAAAAAAAAFA/NyNFiG7KG5I/s1600-h/withOutHerps.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 254px; height: 254px;" src="http://1.bp.blogspot.com/_HS79_lZtUkM/SZ4DuInIOCI/AAAAAAAAAFA/NyNFiG7KG5I/s320/withOutHerps.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5304681502209488930" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_HS79_lZtUkM/SZ4Dtx6_m5I/AAAAAAAAAE4/Svd2e2D0sTQ/s1600-h/withHerps.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 254px; height: 254px;" src="http://3.bp.blogspot.com/_HS79_lZtUkM/SZ4Dtx6_m5I/AAAAAAAAAE4/Svd2e2D0sTQ/s320/withHerps.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5304681496118795154" /&gt;&lt;/a&gt;&lt;br /&gt;*Test image in photoshop&lt;br /&gt;&lt;br /&gt;For my midterm in Nature of Code I am going to attempt to simulate the look of cold sores on pictures of my friends. Here is a break down of the steps I think will be necessary to create a realistic effect:&lt;br /&gt;&lt;br /&gt;1. Create a father point and assign an amount of energy. The amount of energy will determine how large it will be and how many children it can have.&lt;br /&gt;&lt;br /&gt;2. Create children points that surround the father point. Children points energy levels should be smaller than the fathers energy level. Some children can have children of their own if they are large enough.&lt;br /&gt;&lt;br /&gt;3. The energy level of each point will determine the size of a circle like shape that emanates from the point. The circles of all the points will be averaged together and a blob shape will be drawn.&lt;br /&gt;&lt;br /&gt;4. Repeat step 3 but decrease the energy level each time. At the same time, change the color so that the resultant shape defines the form of a blister.&lt;br /&gt;&lt;br /&gt;5. Determine the direction of the light source in the image and use that vector to add shadow and then highlights.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_HS79_lZtUkM/SZ2gbmosKCI/AAAAAAAAAEw/iAPbRftQSuw/s1600-h/n2176.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 209px;" src="http://2.bp.blogspot.com/_HS79_lZtUkM/SZ2gbmosKCI/AAAAAAAAAEw/iAPbRftQSuw/s320/n2176.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5304572332200437794" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-4255195382388231215?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/4255195382388231215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/02/generative-disease-cold-sores.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4255195382388231215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/4255195382388231215'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/02/generative-disease-cold-sores.html' title='Generative Disease: Cold Sores'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_HS79_lZtUkM/SZ4DuInIOCI/AAAAAAAAAFA/NyNFiG7KG5I/s72-c/withOutHerps.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-6731860856038978265</id><published>2009-02-11T17:15:00.004-05:00</published><updated>2009-02-11T18:38:48.136-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='longboarding'/><category scheme='http://www.blogger.com/atom/ns#' term='worm boarding'/><category scheme='http://www.blogger.com/atom/ns#' term='worm racing'/><category scheme='http://www.blogger.com/atom/ns#' term='Cottontail'/><category scheme='http://www.blogger.com/atom/ns#' term='Adam Colton'/><category scheme='http://www.blogger.com/atom/ns#' term='Springfield VA'/><title type='text'>Worm Boarding at Cottontail Hill</title><content type='html'>&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3179151&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=3179151&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/3179151"&gt;Worm Boarding at Cottontail Hill&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This video has been sitting on my computer for far too long. It was recorded in January of 2006, and the sport of Worm Boarding lasted only for two days.&lt;br /&gt;&lt;br /&gt;Upon finding a water heater box in a suburb of Washington DC, &lt;a href="http://whoisadamcolton.com/"&gt;Adam Colton&lt;/a&gt; and I attempted to ride inside the box down hills. The first night we had no clue how to balance together and we were only able to travel 20 feet before crashing into a curb, rolling over, or just laughing too hard to continue. This did not deter us from understanding the mechanics of what would become known as "Worm Boarding".&lt;br /&gt;&lt;br /&gt;On the second day of trial runs we made a breakthrough in balance technique. Undoubtedly Adam was better at steering, so he would lead. I was pretty good I being still and didn't mind not seeing where I was going, so I was a natural for the rear of the "Worm". A few more runs on lesser neighborhood hills and it was time to do what we knew we must, attempt to ride down Cottontail Hill from the top! This hill is so steep that when it snows it is well-nigh impossible to drive up. Adam C. being who he is, grabbed his camera and Adam S. provided a steady hand in filming.&lt;br /&gt;&lt;br /&gt;We tried several times to no avail. Sadly, the box did not live past that day and no one has ever "Worm Boarded" since. I encourage all of you in trying to ride down a hill in a box. Since you are sitting, you have less distance to fall which means that it doesn't hurt, plus the box does a lot to save your skin. Be sure to wear clothes that cover, and always wear a helmet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-6731860856038978265?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/6731860856038978265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/02/worm-boarding-at-cottontail-hill.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6731860856038978265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6731860856038978265'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/02/worm-boarding-at-cottontail-hill.html' title='Worm Boarding at Cottontail Hill'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-6859660139306728908</id><published>2009-02-09T11:04:00.011-05:00</published><updated>2009-02-09T12:08:38.991-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computational Cameras'/><category scheme='http://www.blogger.com/atom/ns#' term='computer vision'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenCV'/><category scheme='http://www.blogger.com/atom/ns#' term='blobs'/><title type='text'>Granpa looks for OpenCV in the kitchen</title><content type='html'>&lt;a href="http://itporter.wordpress.com/"&gt;Winslow Porter&lt;/a&gt; and I played with the new &lt;a href="http://ubaa.net/shared/processing/opencv/index.html"&gt;OpenCV library&lt;/a&gt; for Processing. Thankfully Granpa was around in the kitchen for us to Capture.&lt;br /&gt;&lt;br /&gt;&lt;object height="302" width="400"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3141522&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=3141522&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="302" width="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/3141522"&gt;Grandpa Loves Valentines Day&lt;/a&gt; from &lt;a href="http://vimeo.com/user850340"&gt;Winslow Porter&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;We also found footage from 1969 of a van making an illegal U-turn in San Francisco.&lt;br /&gt;&lt;br /&gt;&lt;object height="302" width="400"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3139804&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=3139804&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="302" width="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/3139804"&gt;Rainbow Image Detection&lt;/a&gt; from &lt;a href="http://vimeo.com/user850340"&gt;Winslow Porter&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;This effect was created by &lt;a href="http://www.andybest.net/"&gt;Andy Best&lt;/a&gt; in a tutorial he wrote for processing's OpenCV library. You can check out the tutorial &lt;a href="http://createdigitalmotion.com/2009/02/06/processing-tutorials-getting-started-with-video-processing-via-opencv/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Then I stayed up playing with the sketch until I went to class. I did capture an amazing smile though.&lt;br /&gt;&lt;br /&gt;&lt;object height="302" width="400"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3144967&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=3144967&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="302" width="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/3144967"&gt;All-nighter smile&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com/"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Pictures from early on in the evening.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3519/3265741036_93ac0e7144.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 400px; height: 300px;" src="http://farm4.static.flickr.com/3519/3265741036_93ac0e7144.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3370/3265740976_a162c7ede5.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 400px; height: 300px;" src="http://farm4.static.flickr.com/3370/3265740976_a162c7ede5.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3533/3264915643_32cd1ddd9b.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 400px; height: 300px;" src="http://farm4.static.flickr.com/3533/3264915643_32cd1ddd9b.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-6859660139306728908?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/6859660139306728908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/02/granpa-looks-for-opencv-in-kitchen.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6859660139306728908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/6859660139306728908'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/02/granpa-looks-for-opencv-in-kitchen.html' title='Granpa looks for OpenCV in the kitchen'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3519/3265741036_93ac0e7144_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-7811181205654132041</id><published>2009-02-05T12:38:00.015-05:00</published><updated>2009-03-15T14:50:29.321-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visualization'/><category scheme='http://www.blogger.com/atom/ns#' term='Nature of Code'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><title type='text'>Nature of Code week 3: Vectors and Forces</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_HS79_lZtUkM/SYsqO7FXuPI/AAAAAAAAAEg/4vmyZ7xsDoI/s1600-h/thumb.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 200px; height: 200px;" src="http://4.bp.blogspot.com/_HS79_lZtUkM/SYsqO7FXuPI/AAAAAAAAAEg/4vmyZ7xsDoI/s200/thumb.png" alt="" id="BLOGGER_PHOTO_ID_5299375822398273778" border="0" /&gt;&lt;/a&gt;Created a simple simulation of fish swimming in a circle. Then I worked on adjusting the look and feel to create a nicer looking visualization. Click the links to see them in action.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=923"&gt;Fish Tornado&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=983"&gt;Fish Tornado 2&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.openprocessing.org/visuals/?visualID=984"&gt;Fish Tornado 3&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-7811181205654132041?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/7811181205654132041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/02/nature-of-code-week-3-vectors-and.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/7811181205654132041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/7811181205654132041'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/02/nature-of-code-week-3-vectors-and.html' title='Nature of Code week 3: Vectors and Forces'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_HS79_lZtUkM/SYsqO7FXuPI/AAAAAAAAAEg/4vmyZ7xsDoI/s72-c/thumb.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-3065280149022000140</id><published>2009-02-02T11:03:00.007-05:00</published><updated>2009-02-02T11:44:09.631-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Computational Cameras'/><title type='text'>Hue is New York?</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://tbn0.google.com/hosted/images/c?q=6d757e468485a14f_landing"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 400px; height: 266px;" src="http://tbn0.google.com/hosted/images/c?q=6d757e468485a14f_landing" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I am interested in using cameras to gather color data about New Yorkers' wardrobes. The information could be used to create the ideal outfit for a specific part of town or to create a wonderful portrait of the city.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/899143671666161628-3065280149022000140?l=idblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://idblab.blogspot.com/feeds/3065280149022000140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://idblab.blogspot.com/2009/02/hue-is-new-york.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3065280149022000140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/899143671666161628/posts/default/3065280149022000140'/><link rel='alternate' type='text/html' href='http://idblab.blogspot.com/2009/02/hue-is-new-york.html' title='Hue is New York?'/><author><name>Matt Richard</name><uri>http://www.blogger.com/profile/15299176396647905852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_HS79_lZtUkM/SezBmqQbdrI/AAAAAAAAAGU/NaT1pmEwPiA/S220/Picture+5.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-899143671666161628.post-2263846214332017597</id><published>2008-12-16T16:09:00.002-05:00</published><updated>2008-12-16T16:43:06.473-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sensor Dome'/><category scheme='http://www.blogger.com/atom/ns#' term='arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='LED Tile'/><category scheme='http://www.blogger.com/atom/ns#' term='processing'/><category scheme='http://www.blogger.com/atom/ns#' term='physical computing'/><category scheme='http://www.blogger.com/atom/ns#' term='photocells'/><title type='text'>Physical Computing Final: Sensor Dome</title><content type='html'>The Sensor Dome is an interface for controlling light and sound using photocells. Each of the 16 photocells sends a value based on how much it is covered by shade. These values are used to control both the volume of music tracks and the lights above the sensors. The dimming and animation of the lights above the sensors alter the values of the sensors.&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="302"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2478247&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=2478247&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="302"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/2478247"&gt;Sensor Dome performs for YOU!&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="302"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2478203&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=2478203&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="302"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/2478203"&gt;Sensor Dome comes together... almost&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;object width="400" height="302"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2478079&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=2478079&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=00adef&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="302"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/2478079"&gt;Building the Light Dome for the Sensor Dome!&lt;/a&gt; from &lt;a href="http://vimeo.com/mattrichard"&gt;Matt Richard&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Processing Code:&lt;/span&gt;&lt;br /&gt;//Matt Richard(visual) and Eyal Ohana(audio)&lt;br /&gt;&lt;br /&gt;import UDP.*; // import Light Tile library&lt;br /&gt;UDPSend udp; &lt;br /&gt;&lt;br /&gt;import processing.serial.*; // import the Processing serial library&lt;br /&gt;Serial myPort; &lt;br /&gt;&lt;br /&gt;import ddf.minim.signals.*; // import the Minim sound library&lt;br /&gt;import ddf.minim.*;&lt;br /&gt;Minim minim;&lt;br /&gt;AudioOutput out;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//declare variables &lt;br /&gt;int totalSquares = 16; // var for how many squares you want on the screen, !! must be a square itself &lt;br /&gt;int colorMax = 255;&lt;br /&gt;int tracks = 16;&lt;br /&gt;float rectColorArray[][][][]; // create nested array that holds the rects alpha value&lt;br /&gt;float sensorValue[] = new float[tracks]; // array to hold sensor values&lt;br /&gt;AudioPlayer players[] = new AudioPlayer[tracks];&lt;br /&gt;float gain[] = new float[tracks];&lt;br /&gt;float val[]  = new float[tracks];&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;  //colorMax = totalSquares;&lt;br /&gt;  size(240, 240);&lt;br /&gt;  background(0);&lt;br /&gt;  colorMode(HSB, 255);&lt;br /&gt;  noStroke();&lt;br /&gt;  smooth();&lt;br /&gt;&lt;br /&gt;  udp = new UDPSend(this,"10.031.066.202",6038,"/Users/matt/Documents/Processing/libraries/UDP/colorkinetics_lib/header","/Users/matt/Documents/Processing/libraries/UDP/colorkinetics_lib/lookup",200,0);&lt;br /&gt;  myPort = new Serial(this, Serial.list()[0], 9600);&lt;br /&gt;  // read bytes into a buffer until you get a linefeed (ASCII 10):&lt;br /&gt;  myPort.bufferUntil('\n');&lt;br /&gt;&lt;br /&gt;  setup_audio(); // contains all of the setup code for audio(located below)&lt;br /&gt;  setup_visual(); // contains all of the setup code for visual(located below)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void draw() {&lt;br /&gt;  draw_audio();&lt;br /&gt;  draw_visual();&lt;br /&gt;  udp.send();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void serialEvent(Serial myPort) {&lt;br /&gt;  // serialEvent method is run automatically by the Processing applet&lt;br /&gt;  // whenever the buffer reaches the byte value set in the bufferUntil()&lt;br /&gt;  // method in the setup():&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  // read the serial buffer:&lt;br /&gt;  String myString = myPort.readStringUntil('\n');&lt;br /&gt;  // if you got any bytes other than the linefeed:&lt;br /&gt;  if (myString != null) {&lt;br /&gt;    myString = trim(myString);&lt;br /&gt;&lt;br /&gt;    // split the string at the commas&lt;br /&gt;    // and convert the sections into integers:&lt;br /&gt;    int sensors[] = int(split(myString, ","));&lt;br /&gt;&lt;br /&gt;    // print out the values you got:&lt;br /&gt;    for (int sensorNum = 0; sensorNum &lt; sensors.length; sensorNum++) {&lt;br /&gt;      print(sensorNum + ": " + sensors[sensorNum] + " ");&lt;br /&gt;    }&lt;br /&gt;    // add a linefeed after all the sensor values are printed:&lt;br /&gt;    println();&lt;br /&gt;    if (sensors.length &gt; 1) {&lt;br /&gt;      for(int i=0;i &lt; tracks;i++){&lt;br /&gt;        val[i] = map(sensors[i], 100, 300, 7, -30); // map the sensor read to the audible range of the gain for the audio&lt;br /&gt;        sensorValue[i] = map(sensors[i], 20,200,0,colorMax); // map the sensor value for visual&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;////////     AUDIO FUNCTIONS     ////////////////////////////////////////////&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;void setup_audio(){&lt;br /&gt;  minim = new Minim(this);&lt;br /&gt;  out = minim.getLineOut();&lt;br /&gt;&lt;br /&gt;  players[0] = minim.loadFile("01_drums.aif");&lt;br /&gt;  players[1] = minim.loadFile("02_filter.aif");&lt;br /&gt;  players[2] = minim.loadFile("03_flute.aif");&lt;br /&gt;  players[3] = minim.loadFile("04_hard.aif");&lt;br /&gt;  players[4] = minim.loadFile("05_horns.aif");&lt;br /&gt;  players[5] = minim.loadFile("06_pad.aif");&lt;br /&gt;  players[6] = minim.loadFile("07_pad_b.aif");&lt;br /&gt;  players[7] = minim.loadFile("08_bass.aif");&lt;br /&gt;  players[8] = minim.loadFile("09_didge.aif");&lt;br /&gt;  players[9] = minim.loadFile("10_beat_hi.aif");&lt;br /&gt;  players[10] = minim.loadFile("11_beat_low.aif");&lt;br /&gt;  players[11] = minim.loadFile("12_machine.aif");&lt;br /&gt;  players[12] = minim.loadFile("13_click.aif");&lt;br /&gt;  players[13] = minim.loadFile("14_scape.aif");&lt;br /&gt;  players[14] = minim.loadFile("15_strings.aif");&lt;br /&gt;  players[15] = minim.loadFile("16_bells.aif");&lt;br /&gt;  //players[.play();&lt;br /&gt;  for (int i=0; i&lt; players.length; i++) {&lt;br /&gt;    players[i].loop();&lt;br /&gt;  } &lt;br /&gt;}&lt;br /&gt;void draw_audio() {&lt;br /&gt;&lt;br /&gt;  if ( out.hasControl(Controller.GAIN) )&lt;br /&gt;  {&lt;br /&gt;    for (int i = 0; i &lt; players.length; i++) { &lt;br /&gt;      players[i].setGain(val[i]);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;void stop() {&lt;br /&gt;&lt;br /&gt;  // the Audioplayers[ you got from Minim.loadFile()&lt;br /&gt;  for (int i=0; i&lt; players.length; i++) {&lt;br /&gt;    players[i].close();&lt;br /&gt;  }&lt;br /&gt;  out.close();&lt;br /&gt;  // the AudioInput you got from Minim.getLineIn()&lt;br /&gt;  //input.close();&lt;br /&gt;  minim.stop();  &lt;br /&gt;&lt;br /&gt;  // this calls the stop method that &lt;br /&gt;  // you are overriding by defining your own&lt;br /&gt;  // it must be called so that your application &lt;br /&gt;  // can do all the cleanup it would normally do&lt;br /&gt;  super.stop();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;////////     VISUAL FUNCTIONS     ////////////////////////////////////////////&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////&lt;br /&gt;void setup_visual(){&lt;br /&gt;  rectColorArray = new float[floor(sqrt(totalSquares))][floor(sqrt(totalSquares))][3][2];&lt;br /&gt;  for(int x=0; x &lt; sqrt(totalSquares); x++){ &lt;br /&gt;    for(int y=0; y &lt; sqrt(totalSquares); y++){&lt;br /&gt;      rectColorArray[x][y][0][0] = x;&lt;br /&gt;      rectColorArray[x][y][1][0] = 1;&lt;br /&gt;      rectC
