Help needed by Graph Example

Hi Guys

I wanna read my g-Sensor(analog Output) by my Arduino Uno and display it on my Laptop.
Like the example here: http://arduino.cc/en/tutorial/Graph

Now the problem:
When I run the example code, I get so many errors and now, after 2 hours trying to fix them I give up.
Can someone please help me and say me what I should do?

Thank you so much!

(deleted)

We could provide more details. Let me see if I can find a picture.

Just to clarify - the code on the page you linked to splits into two - the first part (up to the closing } brace just after the "delay(2);" ) runs on the Arduino, the rest runs on your laptop using the Processing environment.

spycatcher2k:
the program you are trying to run is a processing sketch, not an arduino sketch.

Thank you for your fast answer! :slight_smile:
What does that mean and how can I execute it, that I can see my data's like the example graph?
Sorry I'm a newbie :~

What does that mean

How can we make "That is not Arduino code" any clearer?

Have you downloaded Processing? Have you tried looking at that code, to see that some of it is Arduino code and some is Processing code? Have you tried pasting the Processing part into Processing?

how can I execute it, that I can see my data's like the example graph?

At the top of the page it says:

Software required

Follow that link, read the documentation, and install Processing.

Oh that is so embarrassing!
I watched many youtube videos for error solution and always thought its in the arduino programmer, because it looks so similar.
Now I’ve installed “Processing 2.1”, copied the code in it, but there is an other error :frowning:

Maybe someone has enogh patience for some more help? :slight_smile:

If you'd like a picture of an answer, I'll go look for one. If you want a real answer, post your code correctly. NOT as a picture. I can't copy and paste your picture into Processing to replicate the problem. Not to mention that you are wasting bandwidth posting pictures. Text is far smaller. You'll be getting a bill at the end of the month.

ok sorry and thank you very much for your help!

" The function readStringUntil(char) does not exist."
The line is maked in the color green in the Code here:

// Graphing sketch

// This program takes ASCII-encoded strings
// from the serial port at 9600 baud and graphs them. It expects values in the
// range 0 to 1023, followed by a newline, or newline and carriage return

// Created 20 Apr 2005
// Updated 18 Jan 2008
// by Tom Igoe
// This example code is in the public domain.

import processing.serial.*;

Serial myPort; // The serial port
int xPos = 1; // horizontal position of the graph

void setup () {
// set the window size:
size(400, 300);

// List all the available serial ports
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()[8], 9600);
// don't generate a serialEvent() unless you get a newline character:
myPort.bufferUntil('\n');
// set inital background:
background(0);
}
void draw () {
// everything happens in the serialEvent()
}

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:
float inByte = float(inString);
inByte = map(inByte, 0, 1023, 0, height);

// draw the line:
stroke(127,34,255);
line(xPos, height, xPos, height - inByte);

// at the edge of the screen, go back to the beginning:
if (xPos >= width) {
xPos = 0;
background(0);
}
else {
// increment the horizontal position:
xPos++;
}
}
}

Processing 1.5.1 compiles that code just fine.
Processing 2.1.0 does not. The example code on the Processing reference page for Serial::readStringUntil() method doesn't even compile.

Stick with 1.5.1 until Processing gets their shit together.