etch-a-sketch

Kelsey Gibson

Amanda Hennells

For our project, we made an etch-a-sketch that has colors.

Our project works like a normal etch-a-sketch. It has the up and down knob on the left side and the left and right knob on the right. However, we made a more 'advanced' etch-a-sketch by adding colors. by using the top three knobs, you can change the color to whatever you want. The red is on the far left, blue is in the middle, and green is on the far right. You can change the color of the background by pressing certain buttons such as b is blue r is red etc., and if you want to save a picture, you can press the s button and it will save, also, if you press any of the numbers, it will change the easing number. By adjusting the colors, you can make any color from black to white. Also, instead of having to shake the etch-a-sketch when you want to start over, you can just press any button on the keyboard to reset it.

import processing.serial.*;
import cc.arduino.*; //arduino is hooked up, look for it where it says Arduino
Arduino arduino; //look for the arduino float x; //make x a floatfloat y; //make y a floatfloat easing=.09; //make the easing .09 so it looks more like a line instead of circlesfloat targetX; //make targetX a floatfloat targetY; //make targetY a floatvoidsetup() {
size(1020, 540); //make the screen 1020 pixels by 540 pixels
background(0,0,0); //make the background start black
arduino = new Arduino(this, Arduino.list()[0], 57600);
}
void draw() {
stroke(arduino.analogRead(2)/4, arduino.analogRead(1)/4, arduino.analogRead(3)/4);
// read the arduino and make pin 2 red, pin 1 green, and pin 3 blue to change the circumference of the circle
fill(arduino.analogRead(2)/4, arduino.analogRead(1)/4, arduino.analogRead(3)/4);
// read the arduino and make pin 2 red, pin 1 green, and pin 3 blue to change the center of the circle
targetX= arduino.analogRead(4);
targetX=map(targetX,0,1023,0,width);
//read the arduino and make pin 4 go left and right as far as the width is so it won't go off the screen
targetY= arduino.analogRead(0);
targetY=map(targetY,0,1023,0,height);
//read the arduino and make pin 0 go up and down as far as the height is so it won't go off the screen
x+=(targetX-x)*easing; //make x move slower so it looks more like a line
y+=(targetY-y) * easing; //make y move slower so it looks more like a line
strokeWeight(3);
ellipse(x,y,4,4); //make a circle wherever x and y are with a radius of 4 and a line thickness of 3 pixels
}
void keyPressed()
{
if(key=='b' || key=='B')
{
background(0,0,255); //if b is pressed make the background blue
}
elseif(key=='r' || key=='R')
{
background(255,0,0); //if r is pressed make the background red
}
elseif(key=='o' || key=='O')
{
background(255,150,0); //if o is pressed make the background orange
}
elseif(key=='p' || key=='P')
{
background(255,0,255); //if p is pressed make the background pink
}
elseif(key=='y' || key=='Y')
{
background(255,255,0); //if y is pressed make the background yellow
}
elseif(key=='w' || key=='W')
{
background(255,255,255); //if w is pressed make the background white
}
elseif(key=='a' || key=='A')
{
background(50,50,0); //if a is pressed make the background brown
}
elseif(key=='q' || key=='Q')
{
background(100,0,100); //if q is pressed make the background purple
}
elseif(key=='k' || key=='K')
{
background(0,255,255); //if k is pressed make the background bright blue
}
elseif(key=='g' || key=='G')
{
background(0,255,0); //if g is pressed make the background green
}
elseif(key=='d' || key=='D')
{
background(0,100,0); //if d is pressed make the background dark green
}
elseif(key=='t' || key=='T')
{
background(0,0,50); //if t is pressed make the background dark blue
}
elseif(key=='s' || key=='S')
{
saveFrame("frames/output-####.png"); //if s is pressed save the picture to the folder
}
elseif(key=='1')
{
easing=.01; //if 1 is pressed then make the easing .01
}
elseif(key=='2')
{
easing=.02; //if 2 is pressed then make the easing .02
}
elseif(key=='3')
{
easing=.03; //if 3 is pressed then make the easing .03
}
elseif(key=='4')
{
easing=.04; //if 4 is pressed then make the easing .04
}
elseif(key=='5')
{
easing=.05; //if 5 is pressed then make the easing .05
}
elseif(key=='6')
{
easing=.06; //if 6 is pressed then make the easing .06
}
elseif(key=='7')
{
easing=.07; //if 7 is pressed then make the easing .07
}
elseif(key=='8')
{
easing=.08; //if 8 is pressed then make the easing .08
}
elseif(key=='9')
{
easing=.09; //if 9 is pressed then make the easing .09
}
elseif(key=='0')
{
easing=.1; //if 0 is pressed then make the easing .1
}
else
{
background(0,0,0);
} //if any button (not above) is pressed, make background black
}

Problems:

One of our problems was that we couldn't get the wires to connect properly. To fix this, we used sodder so the wires would always have a good connection.

Another problem we had was that the wires kept getting unplugged when we put it into the box. To fix this, we tried taping the wires.

A third problem we had was that at the beginning, we didn't know processing at all. For this, we got a book and read about processing and learned lots of different things.

The last problem we had was that there was a dot in the middle of the circle when we tried to draw something. To fix this, we changed the radius to a smaller size so it would fill in that little circle

Things we'd add if we had more time/money:

I would like to make better labels and a key to say which key changed to what color/easing number