I made an Etch-A-Sketch using Processing and the Arduino.
It took me hours because there are a few "gotchas" getting things to work correctly on the Mac.
1: You MUST download the alpha version (2.0a5) of Processing or else you will get a memory use error. This prob took some Googling...
2: Download the Processing library for Arduino, unzip this file
3: Go to your "Sketches" directory, the default is ...Documents/Processing
4: Create a new folder if not present called "libraries"
5: Move the unziped directory ("arduino") into "libraries"
6: Now here's what took another hour of Googling...within "arduino" navigate to Arduino.jar and rename it arduino.jar
7: Quit the application Processing
8: Restart your computer
9: Prepare your Arduino & breadboard with a two potentiometers with one wipe going to A0 and the other to A1
10: With your Arduino connected open the Arduino IDE, and load the script from Examples / Firmata / StandardFirmata
11: Upload that sketch to your Arduino
12: Open Processing IDE and use the following sketch (Note: I commented out my image background):
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
void setup() {
size(640, 400);
// PImage b;
// b = loadImage("hillBG_sm.jpg");
// background(b);
background(255, 204, 0);
fill(255,0,0,128);
noStroke();
arduino = new Arduino(this, Arduino.list()[0], 57600);
for (int i = 0; i <= 13; i++){
arduino.pinMode(i, Arduino.INPUT);
}
}
void draw() {
int a0 = arduino.analogRead(0);
int a1 = arduino.analogRead(1);
ellipse(a0, a1,10,10);
}