# Make a graph plz help

**URL:** <https://discourse.processing.org/t/make-a-graph-plz-help/5300>\
**Category:** Electronics (Arduino, etc.)\
**Tags:** homework\
**Created:** [November 7, 2018, 10:20am UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300 "2018-11-07T10:20:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![martijnroks](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@martijnroks](https://discourse.processing.org/u/martijnroks)\
**Post date:** [November 7, 2018, 10:20am UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/1 "2018-11-07T10:20:31Z")

</div>

Hello,

I need to make a graph like this:  
 ![graph](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c5d76bd1e491ebd583f2dc413307a968fe977fc3.png)

But I need on both axis 0 to 1000.

I get from the arduino random digits that I need to implemend in the graph, this needs to be in real time, so the graphs needs to update it’s self. So there always need to be one point on the graph.

I need this as soon as possible, but I’m stuck and I don’t know how to go further on this point.

I hope some one can help me!

Greetings!

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [November 7, 2018, 10:23am UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/2 "2018-11-07T10:23:20Z")

</div>

Maybe if you provide what you have done so far someone will help you

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 7, 2018, 10:27am UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/3 "2018-11-07T10:27:35Z")

</div>

And the type of Data you get… Or what exactly you need to represent. What i understood is that you either have to represent 2D data, like vectors you receive from the Arduino, or you want it to represent one dimensional data over a period of time.

---

<div class="post-metadata">

**Author:** ![martijnroks](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@martijnroks](https://discourse.processing.org/u/martijnroks)\
**Post date:** [November 7, 2018, 11:51am UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/4 "2018-11-07T11:51:01Z")

</div>

```auto
import processing.serial.*;

Serial myPort; // maakt een object van seriele poort
String val; //ontvangt de data van de seriele poort

void setup ()
{
   size (1000,1000); // maak het canvas
   
  String portName = Serial.list() [0]; // de 0 moet worden veranderd in de poort
  myPort= new Serial(this, portName, 9600);
  
 
  float y =0; 
  float x=0;
  float space = 25; //grote hokjes
  float len1 = 400; // aantal hokjes y- as
  float stopX = 5.960296; // Maximum x-as
  float len2 = stopX-x; // aantal hokjes x-as
  float stopY = 50.882125; // Maximum Y-as
  

 
    
  for (float xx=75; xx<=stopX; xx+=space) // x-as
  {   
    line(xx, y, xx, y+len1);
  }
 
  
  for (float yy=125; yy<=stopY; yy+=space) //y-as
  {  
    line(x, yy, x+len2, yy);
  }
  
}

void draw ()
{
  if (myPort.available() > 0) //als data beschikbaar is
  {
    val = myPort.readStringUntil('\n'); // lees het uit en sla het op in val
    
   if (val != null) // Als er waardes worden uitgelezen gaat de hier in
   {
     float [] list = float( split (val,",")); // data verkregen van arduino wordt bij de komma gesplitsd.
     println(val); // print het uit op het console
     
    float part1 = list[0]; //part1 wordt de de eerst afkoppeling opgeslagen
    float part2 = list[1]; // part2 wordt de tweede afkoppeling opgeslagen
    
    float X= part1; // part1 wordt opgeslagen als X
    float Y= part2; // part2 wordt opgeslagen als Y
   } 
  }
 
 
 background(255);
 
 fill(205,61,62); //Rood vierkant gemaakt
 rect(100, 250, 800, 500);
 
 fill(150,255,0);
 rect(125,275,750,450); // groen vierkant wordt gemaakt 

 
  fill(0); 
  textSize(40); 
  text("GPS Tracker", 350, 220); //Tekst wordt geschreven
  fill(0, 0, 255); 
 
 point (X,Y); // de variabelen uit part1 en part2 worden gebruikt voor de coördinaten
 
}

```

This is the code I have right know, but it doesn’t what I want like I explained above here!

---

<div class="post-metadata">

**Author:** ![martijnroks](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@martijnroks](https://discourse.processing.org/u/martijnroks)\
**Post date:** [November 7, 2018, 11:55am UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/5 "2018-11-07T11:55:45Z")

</div>

What I need is to represent 2D data, if I’m right. Every second I get “cordinates” from the arduino. These are randoms numbers between 0 and 1000.

In processing I need to make a graph like the picture above. So if I get for the cordinates (500,750) then there needs to be a point in de graph that represents the cordinates. But the next second I get another cordinate en the point needs to move to the other location.

I hope you guys know what I mean, because I’m a newbie in processing.

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 7, 2018, 12:48pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/6 "2018-11-07T12:48:31Z")

</div>

So you don’t need a graph, but a coordinate system. And that is actually very easy to do.  
If you need both axis to be 1000, you can have the window size be 100 and then scale it. Inside a “for i \< 10” loop just call text with the right number(in this case i \* 100) and i\*100 depending on the axis, for both sides. Then just do point(x, y) like you did… And that should be it… If you want the previous points to disappear, use background(255) and if not, don’t use it.

---

<div class="post-metadata">

**Author:** ![martijnroks](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@martijnroks](https://discourse.processing.org/u/martijnroks)\
**Post date:** [November 7, 2018, 1:26pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/7 "2018-11-07T13:26:52Z")

</div>

I’m sorry but, I don’t get what you exactly mean. all the coordinate systems that I found on the web this week, weren’t the ones I was looking for

I need to make a x and y axis both until the number 1000. And the numbers I get from the arduino need to go in the graph.

And every second I get a new set of numbers, so the point in the graph need also to change to the other place where x and y axis cross eachother.

I hope you can help me with this, because this is what the assignment says

---

<div class="post-metadata">

**Author:** ![Whahahahaha](https://avatars.discourse-cdn.com/v4/letter/w/3be4f8/32.png) [@Whahahahaha](https://discourse.processing.org/u/Whahahahaha)\
**Post date:** [November 7, 2018, 1:35pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/8 "2018-11-07T13:35:20Z")

</div>

hm not entirely sure what you’re doing with your code, especially the for loops in setup().

```auto
  for (float xx=75; xx<=stopX; xx+=space) // x-as
  {   
    line(xx, y, xx, y+len1);
  }
 
  for (float yy=125; yy<=stopY; yy+=space) //y-as
  {  
    line(x, yy, x+len2, yy);
  }

```

those for loops will never loop because the starting value of xx (75) and yy (125) are already larger than what you gave stopX and stopY.

```auto
float stopX = 5.960296; // Maximum x-as
float stopY = 50.882125; // Maximum Y-as

```

Also i’m not quite sure about what stopX and stopY are in the first place? if you want to make a raster of lines like the graph you described, the “maximum x-as” and “maximum Y-as” should both go to 1000 right?  
you can create this graph with just a nested for-loop:

```auto
fill(0);
textSize(10);
for (float xx=25; xx<=1025-space; xx+=space) { // x-as   
    for (float yy=25; yy<=1025-space; yy+=space) { // y-as

      line(xx, yy, xx, yy+space);
      line(xx, yy, xx+space, yy);
      if(xx == 25) text((int)(yy-space),xx-space,yy);
      else if(yy==25) text((int)(xx-space),xx,yy);
    }
    line(25,1025, 1025,1025);
    line(1025,25,1025,1025);
  }

```

this will create a “graph” in which you can now represent your data.  
also note that the Y-axis is top-to-bottom, instead of what is usual with graphs.

This is the total code I made, hopefully something more like you wanted:

```auto
import processing.serial.*;

Serial myPort; // maakt een object van seriele poort
String val; //ontvangt de data van de seriele poort

float x=0, y=0;
float space = 25; //grootte hokjes

void setup ()
{
  size (1050, 1050); // maak het canvas
  background(255);
  String portName = Serial.list() [0]; // de 0 moet worden veranderd in de poort
  myPort= new Serial(this, portName, 9600);

  //float y =0; 
  //float x=0;
  //float len1 = 400; // aantal hokjes y- as (breedte veld/grootte hokjes)
  //float stopX = 5.960296; // Maximum x-as
  //float len2 = stopX-x; // aantal hokjes x-as
  //float stopY = 50.882125; // Maximum Y-as
}

void draw () {
background(255);

  fill(0);
  textSize(10);
  for (float xx=25; xx<=1025-space; xx+=space) { // x-as   
    for (float yy=25; yy<=1025-space; yy+=space) { // y-as

      line(xx, yy, xx, yy+space);
      line(xx, yy, xx+space, yy);
      if (xx == 25) text((int)(yy-space), xx-space, yy);
      else if (yy==25) text((int)(xx-space), xx, yy);
    }
    line(25, 1025, 1025, 1025);
    line(1025, 25, 1025, 1025);
  }

  if (myPort.available() > 0) //als data beschikbaar is
  {
    val = myPort.readStringUntil('\n'); // lees het uit en sla het op in val

    if (val != null) // Als er waardes worden uitgelezen gaat de hier in
    {
      float [] list = float( split (val, ",")); // data verkregen van arduino wordt bij de komma gesplitsd.
      println(val); // print het uit op het console

      x = list[0]; //part1 wordt de de eerst afkoppeling opgeslagen
      y = list[1]; // part2 wordt de tweede afkoppeling opgeslagen

      //float X1= part1; // part1 wordt opgeslagen als X
      //float Y1= part2; // part2 wordt opgeslagen als Y
      //were just an extra step that's not neccessary
    }
  }

  //fill(205, 61, 62); //Rood vierkant gemaakt
  //rect(100, 250, 800, 500); //for what?

  //fill(150, 255, 0);
  //rect(125,275,750,450); // groen vierkant wordt gemaakt 

  fill(0); 
  textSize(40); 
  text("GPS Tracker", 350, 220); //Tekst wordt geschreven
  fill(0, 0, 255); 

  point (x, y); // de variabelen uit part1 en part2 worden gebruikt voor de coördinaten
}

```

---

<div class="post-metadata">

**Author:** ![Whahahahaha](https://avatars.discourse-cdn.com/v4/letter/w/3be4f8/32.png) [@Whahahahaha](https://discourse.processing.org/u/Whahahahaha)\
**Post date:** [November 7, 2018, 1:41pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/9 "2018-11-07T13:41:09Z")

</div>

ah forgot,  
I made the size of the windows larger to make room for the values on the sides.  
This however creates a problem when plotting your values, because they will now be shifted 50 to the top left.  
this is fixable with

```auto
x = map(x,0,1000,25,1025); //and 
y = map(y,0,1000,25,1025); 

```

this will make 0, 25,  
and 1000 1025.  
you could also simply do

```auto
x + list[0] + 25;
y + list[1] + 25;

```

probably even easier…

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 7, 2018, 3:20pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/10 "2018-11-07T15:20:42Z")

</div>

I’m sorry, i don’t quite get what you want… What you are describing is exactly a coordinate system…  
I’ll just make the most basic setup to get what you described.

```auto
void setup() {
size(600, 600);
}

void draw() {
  int inputX = (int)random(0, 1000);//replace this with the X coordinate you get
  int inputY = (int)random(0, 1000);//replace this with the Y coordinate you get
  for (int x = 0; x <= 10; x++) {
    text(x*100, x*50 + 20, 540); 
    line(x*50+20, 20, x*50+20, 520);
  }
  for (int y = 0; y <= 10; y++) {
    text((10-y)*100, 0,y*50+30);
   line(20, y*50+20,520, y*50+20);
  }
  point(inputX/2 + 20, inputY/2 + 20);
}

```

so it will look like this :

```auto
import processing.serial.*;

Serial myPort; // maakt een object van seriele poort
String val; //ontvangt de data van de seriele poort

void setup ()
{
   size (1000,1000); // maak het canvas
   
  String portName = Serial.list() [0]; // de 0 moet worden veranderd in de poort
  myPort= new Serial(this, portName, 9600);
  
 
  float y =0; 
  float x=0;
  float space = 25; //grote hokjes
  float len1 = 400; // aantal hokjes y- as
  float stopX = 5.960296; // Maximum x-as
  float len2 = stopX-x; // aantal hokjes x-as
  float stopY = 50.882125; // Maximum Y-as
  

 
    
  for (float xx=75; xx<=stopX; xx+=space) // x-as
  {   
    line(xx, y, xx, y+len1);
  }
 
  
  for (float yy=125; yy<=stopY; yy+=space) //y-as
  {  
    line(x, yy, x+len2, yy);
  }
  
}

void draw ()
{
  if (myPort.available() > 0) //als data beschikbaar is
  {
    val = myPort.readStringUntil('\n'); // lees het uit en sla het op in val
    
   if (val != null) // Als er waardes worden uitgelezen gaat de hier in
   {
     float [] list = float( split (val,",")); // data verkregen van arduino wordt bij de komma gesplitsd.
     println(val); // print het uit op het console
     
    float part1 = list[0]; //part1 wordt de de eerst afkoppeling opgeslagen
    float part2 = list[1]; // part2 wordt de tweede afkoppeling opgeslagen
    
    float X= part1; // part1 wordt opgeslagen als X
    float Y= part2; // part2 wordt opgeslagen als Y
   } 
  }
 
 
 background(255);
 
 fill(205,61,62); //Rood vierkant gemaakt
 rect(100, 250, 800, 500);
 
 fill(150,255,0);
 rect(125,275,750,450); // groen vierkant wordt gemaakt 

 
  fill(0); 
  textSize(40); 
  text("GPS Tracker", 350, 220); //Tekst wordt geschreven
  fill(0, 0, 255); 
 

for (int x = 0; x <= 10; x++) {
    text(x*100, x*50 + 20, 540); 
    line(x*50+20, 20, x*50+20, 520);
  }
  for (int y = 0; y <= 10; y++) {
    text((10-y)*100, 0,y*50+30);
   line(20, y*50+20,520, y*50+20);
  }

 point (X/2 + 20,Y/2 + 20); // need to add 20 as offset and divide by 2 because its scaled to half the size...
 
}

```

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [November 10, 2018, 11:24pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/11 "2018-11-10T23:24:43Z")

</div>

Obligatory mention: if you can use libraries, you might want to use grafica:

[https://jagracar.com/sketches/multiplePlots.php](https://jagracar.com/sketches/multiplePlots.php)

It has a lot of the things you want – axis labeling, grid lines, scaling, etc – already implemented, you just need to look at the examples and adapt them to your data.

---

<div class="post-metadata">

**Author:** ![martijnroks](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@martijnroks](https://discourse.processing.org/u/martijnroks)\
**Post date:** [November 17, 2018, 12:28pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/12 "2018-11-17T12:28:16Z")

</div>

Hello,

The graph you made is perfect, but I implemented the code and I don’t get a point in the graph.  
The code on the arduino uno works great and gives out points, but the point don’t come back in the graph.

I have put that last bit of code in there, but it still doesn’t work, so could you please help me this one last time?

```auto
import processing.serial.*;

Serial myPort; // maakt een object van seriele poort
String val; //ontvangt de data van de seriele poort

float x=0, y=0;
float space = 25; //grootte hokjes

void setup ()
{
  size (1050, 1050); // maak het canvas
  
  background(255);
  
  String portName = Serial.list() [0]; // de 0 moet worden veranderd in de poort
  myPort= new Serial(this, portName, 9600);

}

void draw () 
{
  background(255);

  fill(0);
  textSize(10);
  for (float xx=25; xx<=1025-space; xx+=space) { // x-as   
    for (float yy=25; yy<=1025-space; yy+=space) { // y-as

      line(xx, yy, xx, yy+space);
      line(xx, yy, xx+space, yy);
      if (xx == 25) text((int)(yy-space), xx-space, yy);
      else if (yy==25) text((int)(xx-space), xx, yy);
    }
    line(25, 1025, 1025, 1025);
    line(1025, 25, 1025, 1025);
  }

  if (myPort.available() > 0) //als data beschikbaar is
  {
    val = myPort.readStringUntil('\n'); // lees het uit en sla het op in val

    if (val != null) // Als er waardes worden uitgelezen gaat de hier in
    {
      float [] list = float( split (val, ",")); // data verkregen van arduino wordt bij de komma gesplitsd.
      println(val); // print het uit op het console

      x = list[0]; //part1 wordt de de eerst afkoppeling opgeslagen
      y = list[1]; // part2 wordt de tweede afkoppeling opgeslagen

    }
  }
  
    x = map(x,0,1000,25,1025); //and 
    y = map(y,0,1000,25,1025);

   point (x, y);
}

```

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 21, 2018, 12:08am UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/13 "2018-11-21T00:08:33Z")

</div>

I don‘t know about wahahaha‘s code, But did you try out my Version? I tried it and that works for sure, so before i try to Correct the other one, just try that one before 😅

---

<div class="post-metadata">

**Author:** ![martijnroks](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@martijnroks](https://discourse.processing.org/u/martijnroks)\
**Post date:** [November 22, 2018, 6:11pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/14 "2018-11-22T18:11:55Z")

</div>

I tried your code, but that doesn’t work either. The coördinates that the arduino gives, don’t come back in the graph. So the function point doesn’t work or the split function that so the code splits in to a x and y coördinate doesn’t work. I don’t know where it goes wrong, so could someone please help me figure this out? My choice goes to the code from wahahahaha, because the graph is in my opinion better!

Hope some could help me figure this one out.

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 22, 2018, 8:10pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/15 "2018-11-22T20:10:38Z")

</div>

I don‘t know about wahahas code (will Check it When i get on my pc), But my code should Display the Point correctly (Even if the coordinate System is pretty ugly, it should do what it should), so i assume that there is a Problem When receiving the coordinates from your arduino. Try printing out the coordinates to See if they get updated. You can do that by just printing x and y after you set it to the respective list[].

Ok, i just checked it and it works just fine… the only thing is that the point is drawn way to small and can be hidden behind the lines. So you can just set strokeWeight(0) after background and then strokeWeight(10) just before the point is drawn, or just draw an ellipse…

If this still doesn’t work, then it is pretty much guaranteed that you don’t receive correct coordinates from your arduino. Just add after

```auto
x = list[0];
y = list[1];
println(x, y);

```

But since you already print out the val, i assume that it should really give out a vector, else you’d have noticed, so i’m 99% sure you’re just not seeing the point because its too small.

---

<div class="post-metadata">

**Author:** ![martijnroks](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@martijnroks](https://discourse.processing.org/u/martijnroks)\
**Post date:** [November 24, 2018, 12:49pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/16 "2018-11-24T12:49:08Z")

</div>

Yes you where right Lexyth, I didn’t saw the point. But if I implemend the code StrokeWeight the point becomes a little bigger, but the rasters or lines from the graph become also thicker. Isn’t there a way to make the point bigger and maybe a different color?

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 24, 2018, 7:49pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/17 "2018-11-24T19:49:07Z")

</div>

You‘ll have to set strokeWeight to big before the Point and reset it to 0, or 1 after it, so it doesn‘t affect the lines. And you can just use stroke and fill to change the Color of the point and reset it afterwards.

---

<div class="post-metadata">

**Author:** ![martijnroks](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@martijnroks](https://discourse.processing.org/u/martijnroks)\
**Post date:** [November 26, 2018, 3:59pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/18 "2018-11-26T15:59:36Z")

</div>

Thanks Lexyth it works just fine! But the arduino output doesn’t show up in processing and everything seems fine. So I don’t know where to problem is. De arduino code works fine and the processing also, just the data transfer from arduino to processing doesn’t work. If someone could help me figure this out then I’m done!

Arduino code:

```auto

void setup() 
{
randomSeed(analogRead(0));
Serial.begin(9600);
}

void loop()
{
int x = random(0, 1000);
int y = random(0, 1000);
int MyArray [2] = {x,y};
Serial.print(x);
Serial.print(",");
Serial.print(y);
Serial.println();//('\n');

delay(3000);
}

```

Processing code:

````auto
import processing.serial.*;

Serial myPort; // maakt een object van seriele poort
String val; //ontvangt de data van de seriele poort

float x=0, y=0;
float space = 25; //grootte hokjes

void setup ()
{
  size (1050, 1050); // maak het canvas
  
  x = map(x,0,1000,25,1025); //and 
  y = map(y,0,1000,25,1025);
  
  background(255);
  strokeWeight(0);
   
  String portName = Serial.list() [0]; // de 0 moet worden veranderd in de poort
  myPort= new Serial(this, portName, 9600);

}

void draw () 
{
  background(255);

  fill(0);
  textSize(10);
  for (float xx=25; xx<=1025-space; xx+=space) { // x-as   
    for (float yy=25; yy<=1025-space; yy+=space) { // y-as

      line(xx, yy, xx, yy+space);
      line(xx, yy, xx+space, yy);
      if (xx == 25) text((int)(yy-space), xx-space, yy);
      else if (yy==25) text((int)(xx-space), xx, yy);
    }
    line(25, 1025, 1025, 1025);
    line(1025, 25, 1025, 1025);
  }

  if (myPort.available() > 0) //als data beschikbaar is
  {
    val = myPort.readStringUntil('\n'); // lees het uit en sla het op in val

    if (val != null) // Als er waardes worden uitgelezen gaat de hier in
    {
      float [] list = float( split (val, ",")); // data verkregen van arduino wordt bij de komma gesplitsd.
      println(val); // print het uit op het console

      x = list[0]; //part1 wordt de de eerst afkoppeling opgeslagen
      y = list[1]; // part2 wordt de tweede afkoppeling opgeslagen

    }
  }
  
  strokeWeight(14);
  point (x, y); // de variabelen uit part1 en part2 worden gebruikt voor de coördinaten
  strokeWeight(0);
}```
````

---

<div class="post-metadata">

**Author:** ![Whahahahaha](https://avatars.discourse-cdn.com/v4/letter/w/3be4f8/32.png) [@Whahahahaha](https://discourse.processing.org/u/Whahahahaha)\
**Post date:** [November 26, 2018, 4:04pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/19 "2018-11-26T16:04:48Z")

</div>

> [@martijnroks](#):
>
> if (myPort.available() \> 0) //als data beschikbaar is {  
> val = myPort.readStringUntil(‘\n’); // lees het uit en sla het op in val

what does it say when you put  
`println(val);`  
behind this?

that will print what processing gets from the arduino, perhaps something wrong happens there.

---

<div class="post-metadata">

**Author:** ![martijnroks](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@martijnroks](https://discourse.processing.org/u/martijnroks)\
**Post date:** [November 26, 2018, 4:08pm UTC](https://discourse.processing.org/t/make-a-graph-plz-help/5300/20 "2018-11-26T16:08:24Z")

</div>

Nothing happends. I don’t get to see anything so processing doesn’t receive anything from the arduino am I correct?

[Next page](https://discourse.processing.org/t/make-a-graph-plz-help/5300.md?page=2)
