Hi all,
I have this section in my program:
int packetSize = LoRa.parsePacket();
if (packetSize) {
while (LoRa.available()) {
Serial.println ("Display LoRa Read Value "); //debug;
char rx_byte = LoRa.read();
Serial.println (rx_byte);
if (strncmp(rx_byte, "lat", 3) == 0){
{
strcpy (lat1,rx_byte);
}
if (strncmp(rx_byte, "lng", 3) == 0){
{
strcpy (lng1,rx_byte);
rxtime1 = millis(); //time since arduino powered up (for setting how long ago the message was received)
}
}
}
}
}
And I have initialized the variables like this:
char lat1[] = "3333333333333333333333333";
char lng1[] = "4444444444444444444444444";
int rxtime1 = 0; //previously ago
char rx_byte[] = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
When I compile the code it gives these errors:
/home/pc/_ZebsData/GoBuddy-Project/GoBuddy_Work_in_Progress/GoBuddy_Work_in_Progress.ino: In function 'void loop()':
/home/pc/_ZebsData/GoBuddy-Project/GoBuddy_Work_in_Progress/GoBuddy_Work_in_Progress.ino:86:32: warning: invalid conversion from 'char' to 'const char*' [-fpermissive]
if (strncmp(rx_byte, "lat", 3) == 0){
^
In file included from /opt/arduino-1.8.9/hardware/arduino/avr/cores/arduino/Arduino.h:25:0,
from sketch/GoBuddy_Work_in_Progress.ino.cpp:1:
/opt/arduino-1.8.9/hardware/tools/avr/avr/include/string.h:434:12: note: initializing argument 1 of 'int strncmp(const char*, const char*, size_t)'
extern int strncmp(const char , const char , size_t) ATTR_PURE;
^
/home/pc/_ZebsData/GoBuddy-Project/GoBuddy_Work_in_Progress/GoBuddy_Work_in_Progress.ino:88:23: warning: invalid conversion from 'char' to 'const char' [-fpermissive]
strcpy (lat1,rx_byte);
^
In file included from /opt/arduino-1.8.9/hardware/arduino/avr/cores/arduino/Arduino.h:25:0,
from sketch/GoBuddy_Work_in_Progress.ino.cpp:1:
/opt/arduino-1.8.9/hardware/tools/avr/avr/include/string.h:305:14: note: initializing argument 2 of 'char strcpy(char*, const char*)'
extern char strcpy(char , const char );
^
/home/pc/_ZebsData/GoBuddy-Project/GoBuddy_Work_in_Progress/GoBuddy_Work_in_Progress.ino:91:32: warning: invalid conversion from 'char' to 'const char' [-fpermissive]
if (strncmp(rx_byte, "lng", 3) == 0){
^
In file included from /opt/arduino-1.8.9/hardware/arduino/avr/cores/arduino/Arduino.h:25:0,
from sketch/GoBuddy_Work_in_Progress.ino.cpp:1:
/opt/arduino-1.8.9/hardware/tools/avr/avr/include/string.h:434:12: note: initializing argument 1 of 'int strncmp(const char, const char, size_t)'
extern int strncmp(const char , const char , size_t) ATTR_PURE;
^
/home/pc/_ZebsData/GoBuddy-Project/GoBuddy_Work_in_Progress/GoBuddy_Work_in_Progress.ino:93:23: warning: invalid conversion from 'char' to 'const char' [-fpermissive]
strcpy (lng1,rx_byte);
^
In file included from /opt/arduino-1.8.9/hardware/arduino/avr/cores/arduino/Arduino.h:25:0,
from sketch/GoBuddy_Work_in_Progress.ino.cpp:1:
/opt/arduino-1.8.9/hardware/tools/avr/avr/include/string.h:305:14: note: initializing argument 2 of 'char strcpy(char*, const char*)'
extern char *strcpy(char *, const char *);
Do you know how I might be able to fix this?
Any help would be amazing!
Zeb