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