Download ESP8266 Book
Transcript
Programming The ESP8266 allows you to write applications that can run natively on the device. You can compile C language code and deploy it to the device through a process known as flashing. In order for your applications to do something useful, they have to be able to interact with the environment. This could be making network connections or sending/receiving data from attached sensors, inputs and outputs. In order to make that happen, the ESP8266 contains a core set of functions that we can loosely think of as the operating system of the device. The services of the operating system are exposed to be called from your application providing a contract of services that you can leverage. These services are fully documented. In order to successfully write applications for deployment, you need to be aware of the existence of these services. They become indispensable tools in your tool chest. For example, if you need to connect to a WiFi access point, there is an API for that. To get your current IP address, there is an API for that and to get the time since the device was started, there is an API for that. In fact, there are a LOT of APIs available for us to use. The good news is that no-one is expecting us to memorize all the details of their use. Rather it is sufficient to broadly know that they exist and have somewhere to go when you want to look up the details of how to use them. To sensibly manage the number and variety of these exposed APIs, we can collect sets of them together in meaningful groups of related functions. This gives us yet another and better way to manage our knowledge and learning of them. The primary source of knowledge on programming the ESP8266 is the ESP8266 SDK API Guide. Direct links to all the relevant documents can be found at Reference documents. See also: • • Espressif Systems – Manufacturers of the ESP8266 Espressif Bulletin Board System – Place for SDKs, docs and forums Boot mode When the ESP8266 boots, the values of the pins known as MTDO, GPIO0 and GPIO2 are examined. The combination of the high or low values of these pins provide a 3 bit number with a total of 8 possible values from 000 to 111. Each value has a possible meaning interpreted by the device when it boots. Page 43