HTTP server (REST & JSON) on Spark core
EN : Local HTTP server (REST & JSON) for Sparkcore
This project implement a Http server on Sparkcore itself. Once compiled into the Web IDE, the server will be available at http://IP-SPARKCORE (port 80 by default).
Common files of projects :
- slre.h
- slre.cpp
- HttpResponse.h
- HttpResponse.cpp
- HttpRequest.h
- HttpRequest.cpp
- http_parser.h
- http_parser.cpp
- SparkTime.h
- SparkTime.cpp
Thanks to :
Projet "spark-Web-Tinker.ino"
- RESTFull URL : http://IP-Sparkcore/D0/on|off
- Digital JSON URL : http://IP-Sparkcore/json/dig/
- Return : {"TS":20140802091229,"D0":0,"D1":0,"D2":0,"D3":0,"D4":0,"D5":0,"D6":0,"D7":1}
- Analog JSON URL : http://IP-Sparkcore/json/ana/
- Return : {"TS":20140802091252,"A0":2127,"A1":2117,"A2":2097,"A3":2098,"A4":2107,"A5":2114,"A6":2083,"A7":2085}
Installation
FR : Serveur HTTP REST et JSON pour Spark Core.
Ce projet permet de mettre en oeuvre un serveur sur le Spark core lui-même.
Un fois compilé dans le Web IDE, le serveur sera accessible à l'adresse http://IP-SPARKCORE (port :80 par défaut). Ce projet est un exemple permettant d'envisager d'autres projet.
Fichiers communs des projets (Rappel .h = fichier d'entête, .cpp = fichier de définition [Sources]) :
- slre.h
- slre.cpp
- HttpResponse.h
- HttpResponse.cpp
- HttpRequest.h
- HttpRequest.cpp
- http_parser.h
- http_parser.cpp
- SparkTime.h
- SparkTime.cpp
Remerciements à :
Projet "spark-Web-Tinker.ino"
- RESTFull URL : http://IP-Sparkcore/D0/on|off.
- Digital JSON URL : http://IP-Sparkcore/json/dig/
- Retour : {"TS":20140802091229,"D0":0,"D1":0,"D2":0,"D3":0,"D4":0,"D5":0,"D6":0,"D7":1}
- Analog JSON URL : http://IP-Sparkcore/json/ana/
- Retour : {"TS":20140802091252,"A0":2127,"A1":2117,"A2":2097,"A3":2098,"A4":2107,"A5":2114,"A6":2083,"A7":2085}
Installation
Old GUI version :
<img src="http://img.youtube.com/vi/ifYkC7UdMVA/0.jpg"
alt="Aller sur Youtube" width="560" border="10" />
<img src="http://img.youtube.com/vi/bbSlwt5ZI3Q/0.jpg"
alt="Aller sur Youtube" width="560" border="10" />
Youtube video 1
Youtube video 2