Skip to content
Tinkerspy edited this page Nov 20, 2016 · 14 revisions

Automaton-Esp8266

Automaton-Esp8266 is an extension to the Automaton framework that supports asynchronous network operations in an event driven manner on the esp8266 microcontrollers. It encapsulates esp8266 library functions in an Automaton like interface.

#include <Automaton.h>
#include <Atm_esp8266.h>

// Minimal Hello World webserver with led control

Atm_esp8266_httpd_simple server( 80 );
Atm_led led;

void setup() {

  led.begin( D5 );

  wifi.begin( "MySSID", "MyPASSWORD" )
    .onChange( true, server, server.EVT_START )
    .start();

  server.begin()
    .onRequest( "/on", led, led.EVT_ON )
    .onRequest( "/off", led, led.EVT_OFF )
    .onRequest( "/blink", led, led.EVT_BLINK )
    .onRequest()
    .reply( "<!DOCTYPE html><html><body>Hello world!</body></html>" );

}

void loop() {
  automaton.run();
}

Wifi manager

The Atm_esp8266_wifi component connects to a wifi network and generates actions on connect and disconnect events.

Web server

The Atm_esp8266_httpd_simple component provides an asynchronous event driven web server with a simple Automaton interface.

Web client###

The Atm_esp8266_httpc_simple component provides an asynchronous event driven web client with a simple Automaton interface.

Examples

hello_world.ino

A very basic webserver that listens to the / url and displays a Hello World! message in the web browser.

Source code: hello_world.ino

Clone this wiki locally