//arduino code const int analogInPin0 = A0; // Analog input pin that the potentiometer is attached to void setup() { Serial.begin(9600); } void loop() { // print the results to the serial monitor: Serial.print(analogRead(analogInPin0)); Serial.print("\n"); delay(100); } //processing arduino 101 import processing.serial.*; Serial myPort; // The serial port float analogPin = 0; void setup () { // set the window size: size(400, 300); // List all the available serial ports // if using Processing 2.1 or later, use Serial.printArray() println(Serial.list()); // I know that the first port in the serial list on my Mac is always my // Arduino, so I open Serial.list()[0]. // Open whatever port is the one you're using. myPort = new Serial(this, Serial.list()[1], 9600); // don't generate a serialEvent() unless you get a newline character: myPort.bufferUntil('\n'); } void draw () { background(255); } void serialEvent (Serial myPort) { // get the ASCII string: String inString = myPort.readStringUntil('\n'); if (inString != null) { // trim off any whitespace: inString = trim(inString); // convert to an int and map to the screen height: analogPin = float(inString); println(analogPin); analogPin = map(analogPin, 0, 1023, 0, 255); } }