Final Post!

I’m pleased with how the electronic etch-a-sketch worked out. It is amazing how complicated even the simplest projects can be – there were lots of things to trouble shoot along the way. One thing helped a lot to simplify my code. Jim suggested that I import the standard firmata library and use processing to read directly from the arduino board instead of making a serial connection (if I understand that right?). It worked well and I have four sketches to share with glitches in every one. I started by drawing the etch-a-sketch in Illustrator, saving it in Photoshop as a jpeg file and used that as a background image in my Processing sketch. Then I needed to constrain the x and y co-ordinates to stay within the visual parameters of the etch-sketch frame. The issue with the first sketch (most like the original toy) is that in order to get a smooth line I need to write the code for “line” after the code that reads the analogRead code and the constrain code. I cannot figure out why the line begins at (0, 0). During the rest of the draw loop it stays within the constrain function. If I want the line to begin where the x and y co-ordinates of the pentiometers, then the code for “line” must come BEFORE the analogRead code. However, the line is choppy and reacts to the speed of the pentiometer readings.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Then I had some fun with colour – tried this with the thin line and a thicker more transparent line.

 

 

 

 

 

 

 

 

 

 

 

 

 

To finish off the concept, I wanted to erase the drawing by turning the etch-a-sketch upside down. I wired in a tilt ball sensor and attached this to digital pin 2 and then altered a piece of code I found that would read whether this “switch” was either HIGH or LOW. If HIGH, then the screen would fill with a light grey rectangle. Else (when turned upside down) the rectangle would fill would change to black. It works except that this if/else statement is written within a “for” loop. So the program only runs the draw loop once and then just keeps drawing the background rectangle. I ┬ácannot tell you how many different ways I tried to “fix” this. This includes trying to run this part of the program in “void setup” so the “void draw” loop runs on top. I wrote drawGreyRectangle and drawBlackRecctangle as functions to call within the Void draw loop and tried to write code that did not use a the “for” statement to activate the switch but this would not work with the Arduino. So after investing 10 hours with not solution I am going to ask for help…. maybe someone tonight can solve the mystery! The code is below…

 

 

Comments are closed.