Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By neldog2
#25084
ian wrote:Attached Diptrace PCB design. I didn't draw a schematic & went straight to a PCB.
I had my boards made at OSH Park. Unfortunately they came back with little holes instead of routed slots for the power connector but it's not the end of the world.


I'm assuming this switches a relay on/off depending on humidity to control something? Do you have code/BOM? I'm just a dabbler in electronics so if it does something completely different just ignore me :)
User avatar
By ian
#25306 I wouldn't ignore you :)

I had two objectives with this, demonstrate a 'realistic' use & develop a board which my students can use.
The original idea was to use this with the DHT11 in a 'greenhouse' Ultimately I didn't bother to use the DHT11 as all I wanted to do was give my seedlings the occasional squirt of water & doing this on the basis of humidity exceeded my agricultural expertise! I wrote it up here: http://www.myiot.co.uk/KISS/
The board I built has progressed a bit. I have something I can use in the lab next year :)
It's basically yet another 'general purpose' ESP8266 board. I've attached a couple of photos. One shows a simple arrangement & the other shows a few I2C devices attached.

Cheers

Ian
newbpard_basic.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
By Strex
#33318 Hi, I'm brand new to the ESP8266, and know enough programming to break stuff. But I've tried to compile your code and I keep on getting the same error, no matter what I try. Also could you please provide the values of any fields that need to be changed? Just as a working example..

I currently have the IPAddress assigned to 192.168.2.6, is this the IP of the MQTT server, or of THIS client?
Code: Select allIPAddress server(192, 168, 2, 6);
PubSubClient client(server);


Error:
Code: Select allArduino: 1.6.5 (Mac OS X), Board: "Adafruit HUZZAH ESP8266, 80 MHz, 115200"

Build options changed, rebuilding all
esp8266-DHTServer-test:10: error: no matching function for call to 'PubSubClient::PubSubClient(IPAddress&)'
esp8266-DHTServer-test.ino:10:27: note: candidates are:
In file included from esp8266-DHTServer-test.ino:2:0:
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:99:4: note: PubSubClient::PubSubClient(const char*, uint16_t, void (*)(char*, uint8_t*, unsigned int), Client&, Stream&)
    PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:99:4: note:   candidate expects 5 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:98:4: note: PubSubClient::PubSubClient(const char*, uint16_t, void (*)(char*, uint8_t*, unsigned int), Client&)
    PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:98:4: note:   candidate expects 4 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:97:4: note: PubSubClient::PubSubClient(const char*, uint16_t, Client&, Stream&)
    PubSubClient(const char*, uint16_t, Client& client, Stream&);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:97:4: note:   candidate expects 4 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:96:4: note: PubSubClient::PubSubClient(const char*, uint16_t, Client&)
    PubSubClient(const char*, uint16_t, Client& client);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:96:4: note:   candidate expects 3 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:95:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, void (*)(char*, uint8_t*, unsigned int), Client&, Stream&)
    PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:95:4: note:   candidate expects 5 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:94:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, void (*)(char*, uint8_t*, unsigned int), Client&)
    PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:94:4: note:   candidate expects 4 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:93:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, Client&, Stream&)
    PubSubClient(uint8_t *, uint16_t, Client& client, Stream&);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:93:4: note:   candidate expects 4 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:92:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, Client&)
    PubSubClient(uint8_t *, uint16_t, Client& client);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:92:4: note:   candidate expects 3 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:91:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, void (*)(char*, uint8_t*, unsigned int), Client&, Stream&)
    PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:91:4: note:   candidate expects 5 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:90:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, void (*)(char*, uint8_t*, unsigned int), Client&)
    PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:90:4: note:   candidate expects 4 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:89:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, Client&, Stream&)
    PubSubClient(IPAddress, uint16_t, Client& client, Stream&);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:89:4: note:   candidate expects 4 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:88:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, Client&)
    PubSubClient(IPAddress, uint16_t, Client& client);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:88:4: note:   candidate expects 3 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:87:4: note: PubSubClient::PubSubClient(Client&)
    PubSubClient(Client& client);
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:87:4: note:   no known conversion for argument 1 from 'IPAddress' to 'Client&'
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:86:4: note: PubSubClient::PubSubClient()
    PubSubClient();
    ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:86:4: note:   candidate expects 0 arguments, 1 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:67:7: note: constexpr PubSubClient::PubSubClient(const PubSubClient&)
 class PubSubClient {
       ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:67:7: note:   no known conversion for argument 1 from 'IPAddress' to 'const PubSubClient&'
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:67:7: note: constexpr PubSubClient::PubSubClient(PubSubClient&&)
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:67:7: note:   no known conversion for argument 1 from 'IPAddress' to 'PubSubClient&&'
esp8266-DHTServer-test.ino: In function 'void loop()':
esp8266-DHTServer-test:28: error: no matching function for call to 'PubSubClient::publish(const char [18], String)'
esp8266-DHTServer-test.ino:28:51: note: candidates are:
In file included from esp8266-DHTServer-test.ino:2:0:
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:113:12: note: boolean PubSubClient::publish(const char*, const char*)
    boolean publish(const char* topic, const char* payload);
            ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:113:12: note:   no known conversion for argument 2 from 'String' to 'const char*'
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:114:12: note: boolean PubSubClient::publish(const char*, const char*, boolean)
    boolean publish(const char* topic, const char* payload, boolean retained);
            ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:114:12: note:   candidate expects 3 arguments, 2 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:115:12: note: boolean PubSubClient::publish(const char*, const uint8_t*, unsigned int)
    boolean publish(const char* topic, const uint8_t * payload, unsigned int plength);
            ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:115:12: note:   candidate expects 3 arguments, 2 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:116:12: note: boolean PubSubClient::publish(const char*, const uint8_t*, unsigned int, boolean)
    boolean publish(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained);
            ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:116:12: note:   candidate expects 4 arguments, 2 provided
esp8266-DHTServer-test:29: error: no matching function for call to 'PubSubClient::publish(const char [15], String)'
esp8266-DHTServer-test.ino:29:48: note: candidates are:
In file included from esp8266-DHTServer-test.ino:2:0:
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:113:12: note: boolean PubSubClient::publish(const char*, const char*)
    boolean publish(const char* topic, const char* payload);
            ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:113:12: note:   no known conversion for argument 2 from 'String' to 'const char*'
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:114:12: note: boolean PubSubClient::publish(const char*, const char*, boolean)
    boolean publish(const char* topic, const char* payload, boolean retained);
            ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:114:12: note:   candidate expects 3 arguments, 2 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:115:12: note: boolean PubSubClient::publish(const char*, const uint8_t*, unsigned int)
    boolean publish(const char* topic, const uint8_t * payload, unsigned int plength);
            ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:115:12: note:   candidate expects 3 arguments, 2 provided
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:116:12: note: boolean PubSubClient::publish(const char*, const uint8_t*, unsigned int, boolean)
    boolean publish(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained);
            ^
/Users/Strex/Documents/Arduino/libraries/pubsubclient-master/src/PubSubClient.h:116:12: note:   candidate expects 4 arguments, 2 provided
no matching function for call to 'PubSubClient::PubSubClient(IPAddress&)'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Any help would be greatly appreciated. Thanks in advance!
User avatar
By yes
#37667
LeXLuther422 wrote:So far it has been running over a day with out locking up sending a message every minute. Last night I did notice something peculiar the AI-THINKER AP is still running and I need to figure out how to disable it.

I'm using ESP-03 modules and have it wired very simply. The DHT has a 100k pullup between 3.3v and data. Data is also wired to GPIO2 on the ESP-03. 3.3v is wired to ESP VCC, CH_PD and DHT VCC . GND is wired to ESP GND, GPIO15 and DHT GND.

Here is am image from benlo.com
Image


you said (The DHT has a 100k pullup between 3.3v and data) the pic shows 10 k ?
it would be nice to see a pic from top of the board ?
well thank for what u have done . mark c