SmingHub/Sming


Sming - Open Source framework for high efficiency native ESP8266 development

http://sminghub.github.io/Sming/

License: LGPL-3.0

Language: C++

Keywords: arduino, async, c-plus-plus, embedded, esp8266, espressif, iot, iot-framework, microcontroller, rboot, sming, ssl-support, wifi


Sming

Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.

ESP8266 C++ development framework

Gitter (chat) Donate Download Build

Summary

  • Fast & user friendly development
  • Work with GPIO in Arduino style
  • High effective in perfomance and memory usage (this is native firmware!)
  • Compatible with standard Arduino libraries - use any popular hardware in few lines of code
  • rBoot OTA firmware updating
  • Built-in file system: spiffs
  • Built-in powerfull network and wireless modules
  • Built-in JSON library: ArduinoJson
  • HTTP, AJAX, WebSockets support
  • MQTT protocol based on libemqtt
  • Networking based on LWIP stack
  • Simple and powerfull hardware API wrappers
  • Based on Espressif NONOS SDK 1.4.0 & 1.5.0

Latest Release

Getting started

Additional needed software

  • Spiffy : Source included in Sming repository
  • ESPtool2 esptool2

You can find more information about compilation and flashing process by reading esp8266.com forum discussion thread.

Examples

More information at Wiki Examples page.

Simple GPIO input/output

#define LED_PIN 2 // GPIO2
...
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, HIGH);

Connect to WiFi and start Serial communication

Serial.begin(9600);
Serial.println("Hello Sming! Let's do smart things.");

WifiStation.enable(true);
WifiStation.config("LOCAL-NETWORK", "123456789087"); // Put you SSID and Password here

Read DHT22 sensor

#include <Libraries/DHT/DHT.h> // This is just popular Arduino library!

#define WORK_PIN 0 // GPIO0
DHT dht(WORK_PIN, DHT22);

void init()
{
  dht.begin();

  float h = dht.readHumidity();
  float t = dht.readTemperature();
}

HTTP client

HttpClient thingSpeak;
...
thingSpeak.downloadString("http://api.thingspeak.com/update?key=XXXXXXX&field1=" + String(sensorValue), onDataSent);

void onDataSent(HttpClient& client, bool successful)
{
  if (successful)
    Serial.println("Successful!");
  else
    Serial.println("Failed");
}

OTA application update based on rBoot

void OtaUpdate() {

    uint8 slot;
    rboot_config bootconf;

    Serial.println("Updating...");

    // need a clean object, otherwise if run before and failed will not run again
    if (otaUpdater) delete otaUpdater;
    otaUpdater = new rBootHttpUpdate();

    // select rom slot to flash
    bootconf = rboot_get_config();
    slot = bootconf.current_rom;
    if (slot == 0) slot = 1; else slot = 0;

    // flash rom to position indicated in the rBoot config rom table
    otaUpdater->addItem(bootconf.roms[slot], ROM_0_URL);

    // and/or set a callback (called on failure or success without switching requested)
    otaUpdater->setCallback(OtaUpdate_CallBack);

    // start update
    otaUpdater->start();
}

Embedded HTTP WebServer

server.listen(80);
server.addPath("/", onIndex);
server.addPath("/hello", onHello);
server.setDefaultHandler(onFile);

Serial.println("=== WEB SERVER STARTED ===");
Serial.println(WifiStation.getIP());

...

void onIndex(HttpRequest &request, HttpResponse &response)
{
  TemplateFileStream *tmpl = new TemplateFileStream("index.html");
  auto &vars = tmpl->variables();
  vars["counter"] = String(counter);
  vars["IP"] = WifiStation.getIP().toString();
  vars["MAC"] = WifiStation.getMAC();
  response.sendTemplate(tmpl);
}

void onFile(HttpRequest &request, HttpResponse &response)
{
  String file = request.getPath();
  if (file[0] == '/')
    file = file.substring(1);

  response.setCache(86400, true);
  response.sendFile(file);
}

Project Statistics

Sourcerank 9
Repository Size 53.6 MB
Stars 1,040
Forks 312
Watchers 136
Open issues 91
Dependencies 0
Contributors 24
Tags 23
Created
Last updated
Last pushed

Top Contributors See all

Skurydin Alexey ADiea Dmitry Kireev hreintke Daniel Walters Nik alonewolfx2 Alexander V. Ribchansky Daniel Nilsson Cassiano Aquino Adam Pierce David flexiti Artsiom Trubchyk Curtis Pope hrsavla Dennis Marinus ystrem Mat shansted

Recent Tags See all

3.5.2 May 02, 2018
3.5.1 March 05, 2018
3.5.0 December 08, 2017
3.4.0 November 06, 2017
3.3.0 July 26, 2017
3.3.0-rc2 July 21, 2017
3.3.0-rc1 July 13, 2017
3.2.0 April 28, 2017
3.1.2 March 08, 2017
3.1.1 February 16, 2017
3.1.0 February 11, 2017
3.0.1 January 09, 2017
3.0.0 December 24, 2016
2.1.5 November 18, 2016
2.1.1 January 10, 2016

Interesting Forks See all

slaff/Sming
Sming - Open Source framework for high efficiency native ESP8266 development
C - LGPL-3.0 - Last pushed - 4 stars - 6 forks
kireevco/Sming
Sming - Open Source framework for high efficiency native ESP8266 development
HTML - LGPL-3.0 - Last pushed - 4 stars - 2 forks
ADiea/Sming
Sming - Open Source framework for high efficiency native ESP8266 development
HTML - LGPL-3.0 - Last pushed - 2 stars - 1 forks
andreabarry1/Sming
Sming - Open Source framework for high efficiency native ESP8266 development
C++ - LGPL-3.0 - Updated - 1 stars
appillustrator/Sming
Sming - Open Source framework for high efficiency native ESP8266 development
C++ - Updated - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2017-11-24 18:52:57 UTC

Login to resync this repository