We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Dear friends,
Through the following arduino program , I am sending float lat , lng values in string form through arduino serial port, sequentially . This program is working successfully.
String lat="17.372651",lng="78.552167";
void setup() {
Serial.begin(9600);
}
void loop() { Serial.print("lat"); delay(1000); Serial.print(lat); delay(1000); Serial.print("lng"); delay(1000); Serial.print(lng); delay(4000); }
The values of lat and lng , are displayed sequentially in arduino IDE serial monitor.
Through the following processing program, I am able see those values sequentially in processing console window.
import processing.serial.*; String inBuffer,lat,lng,temp; int portIndex = 4; Serial myPort;
void setup() { println(Serial.list()); myPort = new Serial(this, Serial.list()[portIndex], 9600); }
void draw() { while (myPort.available() > 0) { inBuffer = myPort.readString(); if (inBuffer != null) { temp=inBuffer; print(temp); }
}
}
But I like to read and store those values as string variables and use them further in my program. Can you give me the way?
K.Sitarama Rao, Electronics Engineer and Hobbyist.
Comments
Please, read the To newcomers in this forum: read attentively these instructions topic. Thanks.
What is displayed in the console? Do you know about split()?