Lua Code
print(adc.read(0))
NodeMCU Flasher
esptool.py –port COMx
Resources
Documentation
https://nodemcu.readthedocs.io/en/release/
print(adc.read(0))
esptool.py –port COMx
https://nodemcu.readthedocs.io/en/release/
ESP8266 ESP-01/ESP-01S
#include <ESP8266WiFi.h>
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.print("Setting soft-AP ... ");
boolean result = WiFi.softAP("ESPsoftAP_01", "pass-to-soft-AP");
if(result == true)
{
Serial.println("Ready");
}
else
{
Serial.println("Failed!");
}
}
void loop()
{
Serial.printf("Stations connected = %d\n", WiFi.softAPgetStationNum());
delay(3000);
}
boolean result = WiFi.softAP("ESPsoftAP_01", "pass-to-soft-AP"); edit the above bold word with your own SSID name and password. Save and recompile your code again.
MQTT is a Client Server publish/subscribe messaging transport protocol. It is light weight, open, simple, and designed so as to be easy to implement. These characteristics make it ideal for use in many situations, including constrained environments such as for communication in Machine to Machine (M2M) and Internet of Things (IoT) contexts where a small code footprint is required and/or network bandwidth is at a premium.
The MQTT protocol aims for these goals:
The MQTT is a publish-subscribe protocol. That is a client sends a message (or publish it) without knowing directly who is going to receive the message, if anyone. The same way, another client can receive messages (or subscribe) without knowing which device has sent it.
In this way, to send or to receive messages, the publishers and subscribers only need to know the broker address. Another advantage is that a broker can deliver a message for a client that is not online at the time it was published.
Let’s create a simple application in Go to send and receive messages using MQTT.