Transmit the longitude and latitude(labview) to arduino and how to separate
I only could receive character. But I want to receive the entire string.
#include <NewSoftSerial.h>
NewSoftSerial xbee(2,3);
int atoi(const char * str);
double d1,d2;
char sz;
char *pEnd;
int ledPin = 13;
int servopin = 9;
void setup()
{
pinMode(ledPin,OUTPUT);
pinMode(servopin,OUTPUT);
xbee.begin(9600);
Serial.begin(9600);
}
void loop()
{
if(Serial.available()>0)
{
digitalWrite(ledPin,HIGH);
sz =Serial.read();
char *pEnd;
d1=strtod(sz,&pEnd);
d2=strtod(pEnd,NULL);
Serial.write(d1);
Serial.write(d2);
}
}