mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-01 05:52:32 +07:00
Arduino Restful Server
This example demonstrates how to use Mongoose to control Arduino using HTTP requests. Example just blinks by LED when Mongoose receives HTTP command, but it can be modified to execute any user-specific code.
At the moment this example supports Arduino Mega 2560 board (and compatible) with either W5100-based network shield (like Arduino Ethernet Shield) or CC3000-based WIFI Shield.
Build and run instructions:
###To run with Arduino Ethernet (W5100) shield:
- Add (Sketch->Add file...) the following files to sketch:
- /mongoose/mongoose.h
- /mongoose/mongoose.c
- /mongoose/platforms/arduino_ethernet_W5100/avrsupport.h
- /mongoose/platforms/arduino_ethernet_W5100/avrsupport.cpp
- Make
board_ipandboard_macvariables suitable for your network and board - Uncomment line
#include <Ethernet.h> - Compile and flash sketch
- Run
curl http://<board_ip/blinkLED attached to PIN 13 will blink and board free memory size and board uptime will be displayed.
###To run with Adafruit WiFi (CC3000) shield:
- Add (Sketch->Add files...) the following files to sketch:
- /mongoose/mongoose.h
- /mongoose/mongoose.c
- /mongoose/platforms/arduino_ethernet_W5100/avrsupport.h
- /mongoose/platforms/arduino_ethernet_W5100/avrsupport.cpp
- Import Adafruit CC3000 library for mongoose (select Sketch->Import Library...->Add library... and point /mongoose/platforms/arduino_wifi_CC3000/adafruit_CC3000_lib_mongoose folder)
- Make the following variables suitable for your network
board_ipsubnet_maskgatewaydnswlan_ssidwlan_pwdwlan_security
- Uncomment line
#include <Adafruit_CC3000.h> - Compile and flash sketch
- Run curl
http://<board_ip/blinkLED attached to PIN 13 will blink and board free memory size and board uptime will be displayed.