Sending data to ESP8266 Wi-Fi chip from Android device

匿名 (未验证) 提交于 2019-12-03 08:30:34

问题:

I have a ESP8266 chip which is connected to the microcircuit. When chip gets value "200" the light is starting to blink 4 times and than it returns "100" value. I need to make an Android app using Java which will connect to the ESP8266 chip, send data to it and will get value "100". I don't know what library I should use to deal with it. Please, help me, how can I do that? I think it is not the most hard question here.

回答1:

For your Controller you dont need any Libary. You just can use the serial AT Commands: http://www.electrodragon.com/w/ESP8266

After setting up your ESP like this:

In your App you should deal with TCP-Sockets: https://de.wikibooks.org/wiki/Googles_Android/_TCP-Sockets

Try something like this in an async task:

socket = new Socket(); socket.connect(new InetSocketAddress(ip, port), Connect_Timeout);  DataOutputStream DataOut = new DataOutputStream(socket.getOutputStream()); DataOut.writeBytes(message); DataOut.flush();  socket.close(); 

So your ESP is the Server and the App the Client. This should work without problems.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!