element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Need help with a couple of warnings on a project's code
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 0 replies
  • Subscribers 390 subscribers
  • Views 212 views
  • Users 0 members are here
  • humidity sensor
  • programming
  • esp8266
  • code
  • wifi_module
  • arduino
Related

Need help with a couple of warnings on a project's code

fabian_sl
fabian_sl over 9 years ago

Hi!!

 

I'm trying to build the following project : Arduino WiFi-Connected Weather Station with Android User Interface - CodeProject

 

The electronics seem to be fine. I can see the arduino and ESP8266 wifi module power leds on , and the TX leds on both of them blinking, but I can't see the ESP8266 wifi signal to make the connection. On the code side, after compiling the code (WeatherStation.ino) I get the following warnings:

 

 

 

In file included from /home/marcelo/FabianStuff/HumiditySensorProject/MirceaFiles/arduino/WeatherStation/WeatherStation.ino:20:0:

/home/marcelo/Arduino_IDE/arduino-1.6.8/libraries/ESP8266/ESP8266.h:71:43: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     Error atCipstartUdp( char* remoteIp = "0", uint16_t remotePort = 0, uint16_t localPort = 1025,

                                           ^

/home/marcelo/Arduino_IDE/arduino-1.6.8/libraries/ESP8266/ESP8266.h: In constructor 'ESP8266::ESP8266(HardwareSerial&)':

/home/marcelo/Arduino_IDE/arduino-1.6.8/libraries/ESP8266/ESP8266.h:55:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

       this->cmdData = "                     ";

                     ^

/home/marcelo/FabianStuff/HumiditySensorProject/MirceaFiles/arduino/WeatherStation/WeatherStation.ino: In function 'void setupWiFi()':

/home/marcelo/FabianStuff/HumiditySensorProject/MirceaFiles/arduino/WeatherStation/WeatherStation.ino:89:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

   esp.atCipstartUdp();

                     ^

In file included from /home/marcelo/Arduino_IDE/arduino-1.6.8/libraries/ESP8266/ESP8266.cpp:9:0:

/home/marcelo/Arduino_IDE/arduino-1.6.8/libraries/ESP8266/ESP8266.h:71:43: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     Error atCipstartUdp( char* remoteIp = "0", uint16_t remotePort = 0, uint16_t localPort = 1025,

                                           ^

/home/marcelo/Arduino_IDE/arduino-1.6.8/libraries/ESP8266/ESP8266.h: In constructor 'ESP8266::ESP8266(HardwareSerial&)':

/home/marcelo/Arduino_IDE/arduino-1.6.8/libraries/ESP8266/ESP8266.h:55:21: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

       this->cmdData = "                     ";

                     ^

 

 

I'm guessing the problem is on the header (ESP8266.h)  but since I'm kind of new to programming I'm not sure if these warnings might be the cause of not being able to communicate to the wifi module. Can anyone please help?

 

 

 

this is the code from the header:

 

#ifndef __ESP8266_H__

#define __ESP8266_H__

 

#include "Util.h"

#include <Arduino.h>

 

class ESP8266 {

  public:

    enum class Error {

      NONE = 0,

      TIMEOUT = 1,

      EMPTY_DATA,

      EMPTY_STREAM

    };

    enum class LinkId {

      ID_0 = 0,

      ID_1 = 1,

      ID_2 = 2,

      ID_3 = 3,

      ID_4 = 4,

      // this is used in only for some

      // commands, such as AT+CIPCLOSE

      ALL = 5,

      // this is used for CIMUX = 0 case

      NONE = 6

    };

    enum class UdpMode {

      DESTINATION_FIXED = 0,

      DESTINATION_CHANGE_ONCE = 1,

      DESTINATION_DYNAMIC = 2

    };

    enum class Channel {

      CH_1 = 1,

      CH_2 = 2,

      CH_3 = 3,

      CH_4 = 4,

      CH_5 = 5,

      CH_6 = 6,

      CH_7 = 7,

      CH_8 = 8,

      CH_9 = 9,

      CH_10 = 10,

      CH_11 = 11

    };

    enum class Encription {

      OPEN = 0,

      WPA_PSK = 2,

      WPA2_PSK = 3,

      WPA_WPA2_PSK = 4

    };

    ESP8266( HardwareSerial& ser): serial( ser) {

      // allocate space for the longest command (20 chars + '\0')

 

// fabian check for error here!!! added one extra space

      this->cmdData = "                     ";

      this->cmdLen = 0;

      this->cTime = 0;

      this->delayMs = 2;

    };

    Error at( uint16_t timeout = 500);

    Error ate0( uint16_t timeout = 500);

    Error ate1( uint16_t timeout = 500);

    Error atRst( uint16_t timeout = 1000);

    Error atCwsap( char* ssid, char* passwd,

      Channel channel = Channel::CH_5,

      Encription enc = Encription::WPA2_PSK,

      uint16_t timeout = 2000);

 

// fabian check for error here!!!

// changed     char* remoteIp = "0"     to        char* remoteIp = 0

    Error atCipstartUdp( char* remoteIp = "0", uint16_t remotePort = 0, uint16_t localPort = 1025,

      UdpMode mode = UdpMode::DESTINATION_DYNAMIC, uint16_t timeout = 5000);

    Error atCipclose( LinkId linkId = LinkId::NONE, uint16_t timeout = 500);   

    Error ipd( char *&data, uint16_t &dataLen, LinkId &linkId, uint16_t waitTime = 0);

    inline Error ipd( char *&data, LinkId &linkId, uint16_t waitTime = 0) {

      uint16_t dataLen = 0;

      return this->ipd( data, dataLen, linkId);

    };

    inline Error ipd( char *&data, uint16_t &dataLen, uint16_t waitTime = 0) {

      ESP8266::LinkId linkId = ESP8266::LinkId::NONE;

      return this->ipd( data, dataLen, linkId);

    };

    inline Error ipd( char *&data, uint16_t waitTime = 0) {

      uint16_t dataLen = 0;

      ESP8266::LinkId linkId = ESP8266::LinkId::NONE;

      return this->ipd( data, dataLen, linkId);

    };

   

    Error atCipsend( char *data, LinkId linkId = LinkId::NONE, uint16_t timeout = 1000);

 

  private:

 

    char *cmdData;

    uint8_t cmdLen;

    uint32_t cTime;

    uint8_t delayMs;

    HardwareSerial& serial;

    void clearSerialBuffer();

    Error checkTimeout( const char* response, uint16_t timeout);

    Error checkTimeout( const char response, uint16_t timeout);

};

 

const char ESP8266_AT[] PROGMEM = "AT";

const char ESP8266_ATE0[] PROGMEM = "ATE0";

const char ESP8266_ATE1[] PROGMEM = "ATE1";

const char ESP8266_AT_RST[] PROGMEM = "AT+RST";

const char ESP8266_AT_RST_READY[] PROGMEM = "ready";

const char ESP8266_AT_CWSAP[] PROGMEM = "AT+CWSAP";

const char ESP8266_AT_CIPSTART[] PROGMEM = "AT+CIPSTART";

const char ESP8266_AT_CIPCLOSE[] PROGMEM = "AT+CIPCLOSE";

const char ESP8266_IPD[] PROGMEM = "+IPD";

const char ESP8266_AT_CIPSEND[] PROGMEM = "AT+CIPSEND";

const char ESP8266_AT_CIPSEND_SEND_OK[] PROGMEM = "SEND OK";

const char ESP8266_CMD_END[] = "\r\n";

const char ESP8266_OK[] = "OK";

const char ESP8266_UDP[] = "UDP";

const char ESP8266_TCP[] = "TCP";

const char ESP8266_ZERO = '0';

const char ESP8266_COMA = ',';

const char ESP8266_DQUOTE = '"';

const char ESP8266_EQUAL = '=';

const char ESP8266_COLON = ':';

const char ESP8266_GREATER_THAN = '>';

#endif

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube