Arduino + Processing = Etch-A-Duino

105 views
Skip to first unread message

Joel Cardinal

unread,
Mar 25, 2012, 3:06:19 AM3/25/12
to larobot...@googlegroups.com
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);
}

Gene Dahilig

unread,
Mar 26, 2012, 12:11:53 PM3/26/12
to larobot...@googlegroups.com
Joel,

That's AWESOME!  I haven't had time to follow up in more detail, but it definitely sounds cool.  I've been wanting to do something with "Processing" since I've seen it mentioned many times in Arduino articles but haven't had a chance look deeper.  

For those that are unfamiliar with Processing (like me), I found a great explanation of it on the Arduino website (http://www.arduino.cc/playground/Interfacing/Processing):

Arduino and Processing
Processing is an open source language/ development tool for writing programs in other computers. Useful when you want those other computers to "talk" with an Arduino, for instance to display or save some data collected by the Arduino.

BTW, at that link above,  I found the Processing library for Arduino (updated 11 Nov 2011), is that the same library you mentioned in step 2? 

Hopefully tonite I'll get a chance to follow your lead and try it out.  Thanks for the info!  

gene  


-- 
gene

“Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand.”

Chinese proverb 

Joel Cardinal

unread,
Mar 28, 2012, 12:39:56 AM3/28/12
to larobot...@googlegroups.com
Gene, yes that is the file you need to download, put in the "libraries" directory and do some renaming on.

Slightly off topic, but if you like Processing there is a Javascript port for web use processingjs.org
Reply all
Reply to author
Forward
0 new messages