2025-12-22
ESP8266 experimentations
I connected an Arduino-compatible ESP8266 to my Mac, flashed a quick sketch to join my WiFi, and set up a simple terminal listener using netcat. Once the device posted a message, the terminal echoed it back, which was a clean end-to-end check that the network connection and client-server flow were working.
Here is the basic terminal command I used on my Mac (replace the port if needed):
nc -l 8080
And here is a minimal ESP8266 sketch that connects to WiFi and sends a message to the listener (replace WiFi creds and the Mac's IP address):
#include <ESP8266WiFi.h>
const char* ssid = \"YOUR_WIFI_SSID\";
const char* password = \"YOUR_WIFI_PASSWORD\";
const char* host = \"192.168.1.10\";
const uint16_t port = 8080;
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(250);
Serial.print('.');
}
WiFiClient client;
if (client.connect(host, port)) {
client.println(\"hello from esp8266\");
client.stop();
}
}
void loop() {}