Trouble with variables type

Hi everybody, I have a code and tried to correct it, it’s supposed to receive data from SDI-12 protocol, save all the information in a SD card and send a message to a cellphone number once the data is ready.

There are plenty of warnings and when debbuging finishes it doesn’t compile. Here are the error messages:

Arduino:1.6.9 (Windows 8.1), Tarjeta:"Arduino Mega ADK"

In file included from C:\Users\LuisArturo\Documents\Arduino\libraries\Arduino-SDI-12-master/SDI12.h:44:0,

                 from C:\Users\LuisArturo\Documents\Arduino\libraries\Variables_2/Variables_2.h:8,

                 from C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:1:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\parity.h:36:2: warning: #warning "This file has been moved to <util/parity.h>." [-Wcpp]

 #warning "This file has been moved to <util/parity.h>."

  ^

In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM.h:46:0,

                 from C:\Users\LuisArturo\Documents\Arduino\libraries\Variables_2/Variables_2.h:7,

                 from C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:1:

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration [enabled by default]

 typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};

                                                                                                                             ^

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino: In function 'void setup()':

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:60:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:60:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:60:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:62:46: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:62:46: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:62:46: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino: In function 'void convert(long unsigned int)':

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:375:19: warning: integer overflow in expression [-Woverflow]

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,

                 from sketch\Datalogger.ino.cpp:1:

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino: In function 'uint8_t envoiefichier(char*)':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/WString.h:38:74: error: initializer fails to determine size of '__c'

 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

                                                                          ^

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:484:24: note: in expansion of macro 'F'

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/WString.h:38:74: error: array must be initialized with a brace-enclosed initializer

 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

                                                                          ^

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:484:24: note: in expansion of macro 'F'

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/WString.h:38:74: error: initializer fails to determine size of '__c'

 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

                                                                          ^

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:486:24: note: in expansion of macro 'F'

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/WString.h:38:74: error: array must be initialized with a brace-enclosed initializer

 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

                                                                          ^

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:486:24: note: in expansion of macro 'F'

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino: In function 'void heure_NTP()':

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:692:77: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:692:77: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:692:77: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

In file included from C:\Users\LuisArturo\Documents\Arduino\libraries\Variables_2/Variables_2.h:8:0,

                 from C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:1:

C:\Users\LuisArturo\Documents\Arduino\libraries\Arduino-SDI-12-master/SDI12.h: At global scope:

C:\Users\LuisArturo\Documents\Arduino\libraries\Arduino-SDI-12-master/SDI12.h:79:22: warning: inline function 'static void SDI12::handleInterrupt()' used but never defined [enabled by default]

   static inline void handleInterrupt(); // intermediary used by the ISR

                      ^

In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM.h:42:0,

                 from C:\Users\LuisArturo\Documents\Arduino\libraries\Variables_2/Variables_2.h:7,

                 from C:\Users\LuisArturo\Documents\IUT Nancy\Stage LIEC\Documents prècédents\Datalogger\Datalogger.ino:1:

C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3MobileClientService.h:78:14: warning: inline function 'virtual int GSM3MobileClientService::connect(IPAddress, uint16_t)' used but never defined [enabled by default]

   inline int connect(IPAddress, uint16_t);

              ^

exit status 1
Error compilación en tarjeta Arduino Mega ADK.

Any suggestions???

Have you considered just debugging a piece of the code at a time?
Such as making sure you know how to receive the SDI-12 data first.

Then add the other pieces later.

Make your life so much easier.

it's supposed to receive data from SDI-12 protocol

A protocol defines how data is presented. It is like saying that we will use grammatically correct English in this forum. It does not make sense to say that you are getting data from English and more than it makes sense to say you are getting data from a SDI-12 protocol.

You may be getting data from a device that communicates using the SDI-12 protocol.

You are compiling some code you have not shared, and getting warnings and errors related to that code. How can you expect us to explain the errors?

Thank you ieee488 I’m going to try to debbug the little pieces of code instead of running it all at a time.

PaulS here is the code.

Datalogger.ino (21.5 KB)

PaulS here is the code.

Some of it, anyway.

#include <Variables_2.h>

How many people here are likely to have that file?

SDI12 mysdi12(DATAPIN);

Where is that class defined?

Oh you are right I forgot to attach the library.

Variables_2.cpp (952 Bytes)

Variables_2.h (793 Bytes)

guerrero-1106: Oh you are right I forgot to attach the library.

You also forgot links to non-core libraries, like SDI12.

I forgot all of these:

SDI-12 library
RTC library
DS1307 library
Time library

Arduino-SDI-12-master.zip (38.9 KB)

DS1307RTC.zip (5.18 KB)

RTClib-master.zip (14.8 KB)

Time-master.zip (27.8 KB)

Now that I have all the libraries, I can compile your code, and, of course, it fails spectacularly.

Datalogger.ino: In function ‘void setup()’:
Datalogger:81: error: ambiguous overload for ‘operator=’ (operand types are ‘String’ and ‘uint8_t {aka unsigned char}’)
Datalogger.ino:81:13: note: candidates are:
In file included from C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/Print.h:26:0,
from C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/Stream.h:26,
from C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\libraries\Wire/Wire.h:26,
from Variables_2.h:6,
from Datalogger.ino:1:
C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:86:11: note: String& String::operator=(const String&)
String & operator = (const String &rhs);
^
C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:86:11: note: no known conversion for argument 1 from ‘uint8_t {aka unsigned char}’ to ‘const String&’
C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:87:11: note: String& String::operator=(const char*)
String & operator = (const char cstr);
^
C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:87:11: note: no known conversion for argument 1 from ‘uint8_t {aka unsigned char}’ to 'const char

C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:88:11: note: String& String::operator=(const __FlashStringHelper*)
String & operator = (const __FlashStringHelper str);
^
C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:88:11: note: no known conversion for argument 1 from ‘uint8_t {aka unsigned char}’ to 'const __FlashStringHelper

In file included from C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:29:0,
from C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/Print.h:26,
from C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/Stream.h:26,
from C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\libraries\Wire/Wire.h:26,
from Variables_2.h:6,
from Datalogger.ino:1:
Datalogger.ino: In function ‘uint8_t envoiefichier(char*)’:
C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:38:74: error: initializer fails to determine size of ‘__c’
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
^
Datalogger.ino:490:24: note: in expansion of macro ‘F’
C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:38:74: error: array must be initialized with a brace-enclosed initializer
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
^
Datalogger.ino:490:24: note: in expansion of macro ‘F’
C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:38:74: error: initializer fails to determine size of ‘__c’
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
^
Datalogger.ino:492:24: note: in expansion of macro ‘F’
C:\Users\pjs9486\Documents\Arduino_160\hardware\arduino\avr\cores\arduino/WString.h:38:74: error: array must be initialized with a brace-enclosed initializer
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
^
Datalogger.ino:492:24: note: in expansion of macro ‘F’
ambiguous overload for ‘operator=’ (operand types are ‘String’ and ‘uint8_t {aka unsigned char}’)

I had to add some #include statements to the .ino file to even get this far. The top now looks like:

#include "Variables_2.h"
#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
#include <Time.h>
#include <EthernetUdp.h>
#include <Wire.h>
#include <GSM.h>
#include <SDI12.h>
#include <RTClib.h>
#include <DS1307RTC.h>

As far as fixing these errors, you start at the top. Fix the FIRST error. Then, compile and fix the first error, until there are no more errors.

Datalogger.ino: In function ‘void setup()’:
Datalogger:81: error: ambiguous overload for ‘operator=’ (operand types are ‘String’ and ‘uint8_t {aka unsigned char}’)

	jouractuel = rtc.Day; // on initialise une variable qui servira a la cr�ation du fichier chaque jour

There is NO excuse for wasting resources converting the day to a String, and, even if there were, it is NOT done this way.

	canalcommande.println(F(buffLoggin)); // On envoie le loggin

The F() macro is to keep string literals out of SRAM. The character array buffLogfin MUST me in SRAM in order for you to write to it. It makes NO sense to then try to wrap it in the F() macro.

After getting rid of the F() macro on that line and the next one, and commenting out the first line that causes an error, the code compiles, but it does not link because there are two classes trying to register handlers for the same two timers.

Thank you very much PaulS, with all these corrections I'm going to start a really good programming work.