Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By raschemmel
#49314 I'm a long time (Nov-2013) arduino user who just got 2 Huzzahs and got the board file installed in the arduino IDE and tested both modules with the Blink example and the Webserver examples from the Adafruit site.
Is there some place I can go to get a better understanding of how the Huzzah differs from an arduino UNO ?
I don't mean specs-wise. I know the clock is 80 Mhz and the Flash size is 4M , but rather with respect to SYNTAX .
I have no webserver experience but I looked at the webserver example and noticed these:
Code: Select all const char* ssid     = "yourssid";
const char* password = "yourpassword";
 
const char* host = "www.adafruit.com";

 const int httpPort = 80;
// Use WiFiClient class to create TCP connections
// We now create a URI for the request
// This will send the request to the server
// Read all the lines of the reply from server and print them to Serial
 


So my question is probably dumb but is all that code based on the HTML language ?
Is there a more systematic way to learn how to use the Huzzah other than looking at other people's code ?
When I started using an arduino everyone recommended I read books on C++ so I bought some but I wound up being so busy doing projects with the UNO by just looking at examples that I never got around to reading the books on C++ (I know, my bad , LOL!). So is using the Huzzah similar ? At first glance it looks like the first thing I need to learn is the syntax or rather, why it is the way it is. What is the best way to learn how to write code for these modules ?
User avatar
By mrburnette
#50358
raschemmel wrote:I'm a long time (Nov-2013) arduino user who just got 2 Huzzahs and got the board file installed in the arduino IDE and tested both modules with the Blink example and the Webserver examples from the Adafruit site.
Is there some place I can go to get a better understanding of how the Huzzah differs from an arduino UNO ?
<...>
So my question is probably dumb but is all that code based on the HTML language ?
Is there a more systematic way to learn how to use the Huzzah other than looking at other people's code ?
When I started using an arduino everyone recommended I read books on C++ so I bought some but I wound up being so busy doing projects with the UNO by just looking at examples that I never got around to reading the books on C++ (I know, my bad , LOL!). So is using the Huzzah similar ? At first glance it looks like the first thing I need to learn is the syntax or rather, why it is the way it is. What is the best way to learn how to write code for these modules ?


@raschemmel:
Hi dude!

The ESP8266 library for WiFi draws from the syntax used in the ArduinoIDE when working with WiFi shields:
http://esp8266.github.io/Arduino/versions/2.3.0/doc/libraries.html

Your Huzzah is very similar to the NodeMCU which some of us run as Arduino-ESP8266... essentially, we wipe the LUA stuff and just upload with Arduino and igrr's core. I personally use my NodeMCU as 1M for Arduino and 3M for SPIFFS.

I have some basic sketches here for the ESP8266: http://www.hackster.io/rayburne/projects that should get you started. All of the HTML (and HTML5) code you need to reference can be found on the Internet ... no need to read a book but if you are a Kindle person, just print the web stuff as PDF and upload. Personally, I put the PDF on an old tablet.

I also sometimes talk about the ESP8266 here: http://stm32duino.com/
Most recently: http://stm32duino.com/viewtopic.php?f=19&t=1226

Prepare for some fun! The ESP8266 can simply "be" an Arduino if you turn off the WiFi:
http://www.hackster.io/rayburne/esp8266-nodemcu-as-arduino-94-mips-under-3-usd-1df8ae

Ray
User avatar
By rudy
#50935 I have found it rather difficult getting my head wrapped around how to work with the ESP8266. A lot of the basic information out there has their origins from the example sketches. Building from them.

There was lots I found confusing. I would find examples on how to do something. Multiple sketches to obtain a similar result but how that result was achieved seemed to be done in different ways. There doesn't seem to be much good documentation on how things work. I found that you have to go through the programs an try to dissect them. Following the functions back into the libraries. And once into the libraries it gets even more confusing because there often are a lot of functions that are not used.

I didn't have any experience with networking before I started with the ESP8266. The learning curve is pretty steep. As you pointed out, there seems to be html involved in a lot of it. But that is only is there is a server and web page involved. (and different ways to embed that code into the firmware) I had spent a fair amount of time learning HTML, HTML5, Javascript, touched on CSS, other stuff that goes into making web pages fancy. But that is only one part of what you can do with the ESP8266.

MQTT is one popular way of getting stuff out beyond our local networks. No HTML involved but you are connecting with other systems that you need to understand.

A lot of the WiFi stuff comes from the work that has been done with the WiFi shield with the Arduino. Some is the same but bits are different.

The question is what do you want to do?

One of the things I learned is that the ESP8266 is not very fast delivering complex web pages. It is not a $3 replacement of a proper computer serving web pages. But it still can do a lot. You just have to be considerate of it's limitations.