Electric dropbolt and some questions related to code.

I’m new on forum and have some question about the code.
I want to control the D13 with APP,but the light out of control.

Two pictures are the same device in different side.
Please give me some advice.

ESP8266_Wifi_Connection_Template.ino (5.77 KB)

Can you explain how far you have got and what works and what does not: 1. Does the ESP8266 make a connection to your wireless lan ? 2. Can you contact the ESP8266 web server from another device (say a PC ) in your network ? 3. Does the relay/drop bolt circuit function if you trigger the relay ?

Can you explain this extract from your code. The comments don't seem to match the statement:

SoftwareSerial ESP8266(4,5); // uno sw RX(pin3) --> esp8266 TX, uno sw TX(pin2) --> esp8266 RX

ESP8266 can contact to our laptop and can make a connection to wireless lan. The problem with Relay and drop bolt has been solved.

The hardware is fine now but the code I write doesn't work. Arduino can't understand the command I create.

That extract is refer to someone else.I have slightly modified it and forgot to correct the comments.

OK. The code compiles without error ? You've got debugMode set to true so you can see log messages on the serial console. How far is it getting ? Does it successfully connect to the WLAN with a message "Wifi connected." ?

There is no error but can’t work.I think there still has some mistake.
And it does shows “server ready” and “wifi connected”.

It looks like you initiate the connection to your WLAN by talking from the Uno to the ESP8266 over software serial and sending AT commands such as "AT+CIPSERVER=1,80". Apparently, that works.

But to set up a web server, you are using are using classes from library WiFi.h such as "WiFiServer server(80)".

Can you give a link to the Wifi.h which you are using and/or the tutorial you are following? I'm not sure it is appropriate for the way that you are using the ESP8266 which apparently has the original firmware to interpret AT commands. Since the code you have written compiles for and runs on a standard Uno, I guess it [the Wifi library] is actually for a Uno Wifi shield and not a remote ESP8266.

The code is refer to this website but it's in Chinese.

http://lolwarden.pixnet.net/blog/post/82031214 http://lets-make-games.blogspot.tw/2015/05/wifi-esp8266-arduino.html

And I found two library "ESP8266Wifi.h" and "ESP8266.h" ,which one will be more appropriate?

https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiWebServer/WiFiWebServer.ino https://github.com/itead/ITEADLIB_Arduino_WeeESP8266

The problem as I see it is this: There are 2 ways to use ESP8266 together with an Arduino. (1) Is to use the original Firmware on the ESP8266 and you send it "AT" commands as you have done to establish the connection to the Wireless LAN. Method (2) is to overwrite the original ESP8266 firmware with the Arduino core software, then you can upload sketches directly onto the ESP8266. It looks like you are trying to do it both ways and this will not work. If you choose to use method 2, you have to know that if you want to revert to method 1 afterwards, you have to reflash the original firmware back on to the ESP8266.

Here is a tutorial from Adafruit (it is actually about their own ESP8266, the Huzzah) bit the same applies generally. 1) Original Firmware method 2) Arduino Core software method.

I tried another way in these few days.I burn the code into each UNO and ESP8266 successfully.After I burn the code in, ESP8266 can’t connect.I can control the LED with the command “ON” and “OFF”, but I want control it remotely.
And these are the code.

test.ino (1.95 KB)

TEST1.ino (1.93 KB)