An open API service indexing awesome lists of open source software.

https://github.com/feiko/esp8266

A better Arduino driver for the esp8266 AT Commands
https://github.com/feiko/esp8266

Last synced: about 1 year ago
JSON representation

A better Arduino driver for the esp8266 AT Commands

Awesome Lists containing this project

README

          

# An ESP8266 Arduino driver

Status: works for reading/writing a single client TCP connection.

A efficient esp8266 driver for Arduino using the AT commands. Main feature is
to never miss a data packet from the server.

example:
```
#include "esp8266.h"
#include

#define ESP_TX 3
#define ESP_RX 2

SoftwareSerial espconn(ESP_TX, ESP_RX);
ESP8266 esp(espconn);
uint8_t packetbuffer[100];

void setup() {
espconn.begin(9600);
Serial.begin(9600);

if (esp.reset()) {
Serial.println(F("wifi reset error"));
return;
}

if (esp.joinAP(SSID, PASS)) {
Serial.println(F("wifi join error"));
return;
}
Serial.println("JOINED");

// setup the packet buffer here, so even if the server pushes data on connect, we get to read it
esp.putPacketBuffer(packetbuffer, sizeof(packetbuffer));

if (esp.tcpOpen(IP, PORT)) {
Serial.println(F("tcp open error"));
return;
}
Serial.println("OPENED");

if (esp.tcpSend((const uint8_t*)"1337\n", 5)) {
Serial.println(F("tcp write error"));
return;
}
Serial.println("WRITTEN");
}

void loop() {
int len = esp.available();
if (len > 0) {
Serial.write(esp.takePacketBuffer(), len);
Serial.println();
esp.putPacketBuffer(packetbuffer, sizeof(packetbuffer));
}
}
```