Data communication from Arduino/Processing Post #1

i am a beginner I would appreciate it if someone help me to write a programme to receive data(62 data) from arduino to processing and class them in a table plz

1 Like

Hello,

What is your your progress so far?
What kind of data?

Get to know the resources available to you.

Resources < Click here to expand !

I encourage you to review the resources available here:

Related:

https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all

:)

1 Like

I am looking for a way to recieve sensor data from arduino to processing and class those data in table in the same order that I recieved them so I can draw graphes with them and display them

@glv I already got the recieving part I juste need to class my data in a table in processing
this is my sending from arduino programme

void setup() {
 
  Serial.begin(9600);
}
void loop() {
  Serial.print(analogRead(A0));
  Serial.print("\n");
  Serial.print(analogRead(A1));
  Serial.print("\n");
  Serial.print(analogRead(A2));
  Serial.print("\n"); 
  delay(500);
}

Hello,

What have you done so far?

:)

Hi, Thanks for the suggestion,
I did an application where I recieved my data from the arduino and decplayed them in graph
now I just need put the data that I recieved in tabular in processing
this is what I did

//Variables to draw a continuous line.
int lastxPos=1;
int lastheight=0;

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

  myPort = new Serial(this, "COM5", 9600);  

  // A serialEvent() is generated when a newline character is received :
  myPort.bufferUntil('\n');
  background(0);      // set inital background:
}
void draw () {
  if (newData) {
    //Drawing a line from Last inByte to the new one.
    stroke(127,34,255);     //stroke color
    strokeWeight(4);        //stroke wider
    line(lastxPos, lastheight, xPos, height - inByte); 
    lastxPos= xPos;
    lastheight= int(height-inByte);

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

void serialEvent (Serial myPort) {
  // get the ASCII string:
  String inString = myPort.readStringUntil('\n');
  if (inString != null) {
    inString = trim(inString);                // trim off whitespaces.
    inByte = float(inString);           // convert to a number.
    inByte = map(inByte, 0, 1023, 0, height); //map to the screen height.
    newData = true; 
  }
}
1 Like