Graph in processing

Hello,

I need to make a graph with GPS information embedded into it.
I need to have the let and long in the graph. We get the information from the arduino with the sensor GP20U7.

The graph needs to show a realtime location. We have to long and let from the building, but I’m very new to processing and I don’t know how to build a graph.

I also don’t how to embed the information that the sensor sends to the arduino into the graph in processing.

The code I allready have is this:

import processing.serial.*;

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


void setup() { 
  background(255);
 
  size (800,600); // maak het canvas
   
  String portName = Serial.list() [0]; // de 0 moet worden veranderd in de poort
  myPort= new Serial(this, portName, 9600);
 
 
  fill(0); 
  textSize(40); 
  text("GPS Tracker", 250, 75); 
  fill(250,0,0); 


 
  int y = 125;             //stand y-as
  int x=75;                // stand x-as
  int space = 25;         // grote hokjes
  int len1 = 400;         // aantal hokjes
  int stopX = 750;
  int len2 = stopX-x; 
  int stopY = y+len1;
 
  //Horizontal lines
  for (int xx=75; xx<=stopX; xx+=space) { 
    line(xx, y, xx, y+len1);
  }
 
  //Vertical lines  
  for (int yy=125; yy<=stopY; yy+=space) { 
    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
   {
     println(val); // print het uit op het console
   }
    
  }
  fill(0,0,0); 
  ellipse(400,400, 25, 25);           // circel getekend
}

I hope some one can help me!

1 Like

It’s long and lat (not let)

there’s a library for geo things like this

here is also a tutorial and a download to be found:

see Prevent Unfolding Map from panning off screen

(one year old…?)

1 Like