Build Arduino Server Pages Using the MVC Web Framework
Looking to build sophisticated web applications for the Arduino platform?
The book Arduino Web Development: Pushing the Limits explores the latest Arduino MVC Web Framework, designed for building complete applications using Arduino Server Pages (ASP).
Author dynamic web content (HTML, XML or JSON) in a way that professional developers are familiar with. Benefit from the productivity of server side scripting, combined with the performance of compiled C++.
Integrate the (free) view generator utility to convert ASPs to C++ view classes, and begin your projects using the output of a code generator.
Work through the book’s coding exercises and build the skills to broaden the types of applications possible. Review the book’s table of contents now to discover how you can start developing sophisticated Arduino web applications.
“the productivity of server side scripting, combined with the performance of compiled C++”
Arduino MVC Web Framework Key Features
The Arduino MVC Web Framework has been tested to build using Arduino IDE v 2.x. Projects based on it can deploy to Arduino R3/R4 Uno and Mega 2560 (using Wiznet Ethernet shields), and various ESP8266 boards. It offers the following features:
- Implements model, view, controller design
- RESTful URLs with simplified parameter processing
- Model binding for HTTP POST requests
- UI consistency with layout (master) pages
- AJAX requests and partial rendering of views
- Easy to implement JSON or Xml Web APIs
- Cookie based authentication for Web pages and APIs
- File upload and attachments download support
- Static content served from SD card or ROM
- Support for asynchronous request processing
Download the Arduino MVC Web Framework and Book Source Code Examples
- Arduino MVC Web Server library and required StringBuilder library and Messaging library
- Source code examples for the book: Arduino Web Development: Pushing the Limits
- Example web applications
- Utilities Arduino.MVC.NewProj.exe and Arduino.MVC.CodeGen.exe. The former generates project templates, the latter generates C++ view classes from Arduino Server Pages
Additional Software Tools Needed for Getting Started
Depending on whether you’re using an ethernet shield or an ESP8266, you’ll need to use the Arduino IDE to install either the Ethernet library or the ESP8266 board. Some projects also require an Arduino SD card reader. Be sure to change the MAC and IP address in the source code to values that are correct for your network configuration. Copy downloaded ‘web’ and ‘data’ folders to the root of the Arduino SD card.
Arduino Server Page (ASP) files are normally found in the sub folder asp_files of an Arduino project. These files are not editable using the Arduino IDE, but can be edited using an editor such as notepad++. Their view classes can be generated manually using the online view builder, or the downloadable utility Arduino.MVC.CodeGen.exe.
Build Arduino Projects with Visual Studio Code
Alternatively, Visual Studio Code (VS Code) can be adopted as the IDE for editing all of the project’s files and uploading to an Arduino. With the latter option, ASP files can be converted to view classes automatically as part of the project build process. The Arduino IDE must still be installed to be able to use VS Code.
The advantage of using Visual Studio Code for building Arduino projects is that scripts can be invoked during the prebuild event. In this case a script is invoked for generating C++ view classes from ASP files before the project is built and uploaded to an Arduino.
The Visual Studio Code Arduino extension must be installed and configured to use the Arduino CLI. To run view generation scripts, is is necessary to install the view generation utility (Arduino.MVC.CodeGen.exe), .NET and PowerShell. Be sure to review the readme files that accompany the above downloads for additional instructions.
“a seamless Arduino web development environment like never before”
To create your own Arduino projects using Arduino Server Pages and the MVC Web Framework, use the provided Arduino.MVC.NewProj.dll utility at the command line. The example below will create an Arduino web project with the pages Home and About.
> dotnet Arduino.MVC.NewProj.dll Web_Project Home About
Please watch the short demonstration video of the Arduino MVC Web Framework. Although it is for a much earlier version, the main idea still applies. Download the source code and build web applications with a seamless Arduino web development environment like never before. Get ready to push the limits of web development using the Arduino MVC Web Framework.
Looking for more web projects? Try Six Arduino Web Projects: Beginner to Advanced.