Hey everyone,
Please see the attached code.
I'm trying to 'transmit' GPS data being received to my receiver which is connected to second arduino.
I've written comment on the place I'm stuck at, please have a look and let me know how can I fix it or if there's an alternative way to transmit the data to the receiver.
Thanks.
#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
#include <SoftwareSerial.h>
#define PMTK_SET_NMEA_UPDATE_1HZ "$PMTK220,10001F" //GPS Speed
#define PMTK_SET_NMEA_OUTPUT_ALLDATA "$PMTK314,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,028" // GPS Data
#define rxPin 10
#define txPin 7
String message;
char sentvalues[27];
SoftwareSerial mySerial(rxPin, txPin);
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("UP501 NMEA test!");
Serial.println("setup");
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
mySerial.begin(9600);
mySerial.println(PMTK_SET_NMEA_OUTPUT_ALLDATA);
mySerial.println(PMTK_SET_NMEA_UPDATE_1HZ);
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_set_tx_pin(9); // Tx for transmitter
vw_setup(4000); // Bits per sec
}
void loop()
{
// Following is used to get GPS data
if (mySerial.available())
Serial.print((char)mySerial.read());
if (Serial.available())
mySerial.print((char)Serial.read());
//Following is to Transmit that data in form of a message
message = mySerial.read(); //This is where I'm stuck at as its an invalid conversion from int to constchar
message.toCharArray(sentvalues, 27);
vw_send((uint8_t *)sentvalues, strlen(sentvalues));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
}
whole2.ino (1.39 KB)