Hi All, Working on a project in which I need to make GR board to send values to a platform. For the same I am using Ethernet library. But there seems to be some problem with it. Following is the code: /* GR-KAEDE Sketch Template V1.15 */ #include Arduino.h #include Ethernet.h #include stdio.h #include "string.h" String APIKEY = "765c66f66a91c85dec1d8c738a87efb288ebab5e50fc"; String DEVICE = "@uncleashi.uncleashiqazs"; // Enter a MAC address for your controller below. // Newer Ethernet shields have a MAC address printed on a sticker on the shield byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED IPAddress ip(192,168,1,27); IPAddress server(82,223,244,60); EthernetClient client; // Initialize the library instance // The setup routine runs once when you press reset void setup() { Serial.begin(9600); // Start serial port Serial.println(F("Starting")); Ethernet.begin(mac,ip); // Start the Ethernet connection delay(1000); // Give the Ethernet shield a second to initialize } // The loop routine runs over and over again forever void loop() { String txt = ""; // Text to send txt = "InComing!!!"; Serial.println(txt); // For debugging purpose only if (client.connect(server, 80)) { // If there's a successful connection Serial.println(F("connected")); // Build the data field String json = "{\"protocol\":\"v2\",\"device\":\"@uncleashi.uncleashi\",\"at\":1356390000,\"data\":{\"light\":\""+txt+"\"}}"; // Make a HTTP request client.println("POST /streams HTTP/1.1"); client.println("Host: api.carriots.com"); client.println("Accept: application/json"); client.println("User-Agent: Arduino-Carriots"); client.println("Content-Type: application/json"); client.print("carriots.apikey: "); // client.println(APIKEY); client.println("765c66f66a91c85dec1d8c738a8cbe350eb6cc2122c8cb57efb288ebab5e50fc"); client.print("Content-Length: "); int thisLength = json.length(); client.println(thisLength); client.println("Connection: close"); client.println(json); } else { Serial.println(F("connection failed")); } if (!client.connected()) { client.stop(); } } Following is the error which I am getting due to "client.println(json) and client.println(thisLength)": The Compilation Is Complete rx-elf-gcc -Wall -I"C:/Renesas/e2studio/GNURXv14.03-ELF/rx-elf/rx-elf/rx-elf/include" -I. -I"C:/Renesas/e2studio/GNURXv14.03-ELF/rx-elf/rx-elf/lib/gcc/rx-elf/4.8-GNURX_v14.03/include" -I"C:/Renesas/e2studio/GNURXv14.03-ELF/rx-elf/rx-elf/rx-elf/include/c++/4.8-GNURX_v14.03/" -I"C:/Renesas/e2studio/GNURXv14.03-ELF/rx-elf/rx-elf/rx-elf/include/c++/4.8-GNURX_v14.03/rx-elf/64-bit-double/" -ffunction-sections -fno-function-cse -fsigned-char -fdata-sections -mno-balign -DGRKAEDE -DGRSAKURA -DARDUINO=144 -DCPPAPP -D__RX_LITTLE_ENDIAN__=1 -D__T4__ -g2 -g -flto -mlittle-endian-data -m64bit-doubles -mcpu=rx64m -I./gr_build -I./gr_common -I./gr_common/core -I./gr_common/core/avr -I./gr_common/core/utility -I./gr_common/core/utility/driver -I./gr_common/core/utility/r_byteq_v1.30 -I./gr_common/core/utility/r_config -I./gr_common/core/utility/T4_src -I./gr_common/core/utility/T4_src/checksum -I./gr_common/core/utility/T4_src/checksum/rx -I./gr_common/lib -I./gr_common/lib/EEPROM -I./gr_common/lib/EEPROM/utility -I./gr_common/lib/Firmata -I./gr_common/lib/Image -I./gr_common/lib/Image/utility -I./gr_common/lib/LiquidCrystal -I./gr_common/lib/SD -I./gr_common/lib/SD/utility -I./gr_common/lib/Servo -I./gr_common/lib/SoftwareSerial -I./gr_common/lib/SPI -I./gr_common/lib/Stepper -I./gr_common/lib/Wire -I./gr_common/lib/Wire/utility -I./gr_common/rx64m -I./USB_Driver -c -x c++ gr_sketch.cpp -o gr_sketch.o gr_sketch.cpp: In function 'void loop()': gr_sketch.cpp:55:30: error: invalid conversion from 'int' to 'const char*' [-fpermissive] client.println(thisLength); ^ In file included from gr_sketch.cpp:3:0: ./gr_common/core/Ethernet.h:256:16: error: initializing argument 1 of 'size_t EthernetServer::println(const char*)' [-fpermissive] size_t println(const char c[]){ /* get the length of the string * s return. '/ 0' is not included in length. */ ^ gr_sketch.cpp:57:24: error: no matching function for call to 'EthernetClient::println(String&)' client.println(json); ^ gr_sketch.cpp:57:24: note: candidates are: In file included from gr_sketch.cpp:3:0: ./gr_common/core/Ethernet.h:256:16: note: size_t EthernetServer::println(const char*) size_t println(const char c[]){ /* get the length of the string * s return. '/ 0' is not included in length. */ ^ ./gr_common/core/Ethernet.h:256:16: note: no known conversion for argument 1 from 'String' to 'const char*' ./gr_common/core/Ethernet.h:267:16: note: size_t EthernetServer::println() size_t println(void){ ^ ./gr_common/core/Ethernet.h:267:16: note: candidate expects 0 arguments, 1 provided make: *** [gr_sketch.o] Error 1 Any Help would be appreciated. Thanks in advance.
↧