Arduino ESP8266 Library

寵の児 提交于 2019-12-08 06:45:40

问题


I am new to arduino and just picked up myself an UNO and an ESP8266 module. I've managed to wire them all up properly and connected to my home network using the AT commands.

But now im trying to follow tutorials on the internet but the problem is every example includes a library

#include <ESP8266WiFi.h>

such as this example tutorial https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/example-sketch-ap-web-server

So I have tried googling for it but can't find anything. I'm assuming thats because its really simple and Im missing something quite obvious.

help?


回答1:


If you wish to use the Arduino as the main part of your ESP8266 project, there are several ways to go.

  • Use the Arduino to issue AT commands to the ESP8266.
  • Create your own protocol or messaging system by programming up the ESP8266 with (for example) nodemcu or the Arduino/ESP8266 project or Espressif or others, then program up your Arduino with the same protocol or messaging system so the two may talk.

Alternatively, just program your ESP8266 directly. No Arduino required. Doing so, you can turn the tables and get the ESP8266 to issue messages to the Arduino if for example if you wanted the many GPIO and sense pins of the Arduino to do something. If you only need a couple of extra GPIO pins, look at the ESP8266 range to get more GPIO pins, such as the ESP8266-12

Which to choose?

  • nodemcu will give you a good idea of the capabilities of the ESP8266 and may be a good starter, easy to flash, easy to program, but it is a poor finisher except for the most basic of programs.
  • espressif has a large toolchain, not pleasant to flash, you'll be at the cutting edge, however the community support is minimal
  • The Arduino/ESP8266 project is awesome, easy to flash, very fast, very stable, and unlike nodemcu you can create a large project. As you noticed, any arduino project starting with #include <ESP8266WiFi.h> is not for the arduino, but for the ESP8266 using the arduino IDE https://github.com/esp8266/Arduino



回答2:


The Sparkfun example, it's for the ESP8266 Thing and it's using the Arduino ESP8266 Core, to flash the module.
It's not Arduino code that communicates with the module over serial. You need to upload this code to ESP module and with the Arduino ESP8266 Core, it's possible to program the ESP directly from the Arduino IDE.



来源:https://stackoverflow.com/questions/35666917/arduino-esp8266-library

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