Yeoman generator for creating AngularJS web applications with Arduino - lets you quickly set up a project and upload it to your Arduino.
Forked from AngularJS Full-Stack generator
Source code: https://github.com/lasselukkari/angular-arduino-demo
First, you'll need to install yo
and other required tools:
npm install -g yo bower grunt-cli
Install generator-angular-arduino
:
npm install -g generator-angular-arduino
Make a new directory, and cd
into it:
mkdir my-new-project && cd $_
Run yo angular-arduino
, optionally passing an app name:
yo angular-arduino [app-name]
Run grunt
for building + uploading, grunt serve
for ui preview.
To build the project run grunt build
. The built project in dist/server is compatible with the Arduino IDE.
See generated grunt file for more available tasks.
- Arduino IDE 1.6.5 or later
- aWOT - Download aWOT either to your Arduino libraries folder or copy the .h and .cpp files to the server directory.
Client
- Scripts:
JavaScript
,CoffeeScript
,Babel
- Markup:
HTML
,Jade
- Stylesheets:
CSS
,Stylus
,Sass
,Less
, - Angular Routers:
ngRoute
,ui-router
Server
- Platform presets:
Uno
,Mega
,Due
,Teensy3
,ESP8266
Custom platform options can be set manually.
Arduino Uno is barely usable. On Uno the example project consumes almost all available memory resources. Remove Serial lib to free some space.
To enable the ESP8266 refer to github.com/esp8266/Arduino
A grunt task looks for new files in your client/app
and client/components
folder and automatically injects them in the appropriate places based on an injection block.
less
files intoclient/app.less
scss
files intoclient/app.scss
stylus
files intoclient/app.styl
css
files intoclient/index.html
js
files intoclient/index.html
coffeescript
tempjs
files intoclient/index.html
babel
tempjs
files intoclient/index.html
Available generators:
- App
- Server Side
- Client Side
Sets up a new AngularJS + aWOT app, generating all the boilerplate you need to get started.
Example:
yo angular-arduino
Generates a new API endpoint.
Example:
yo angular-arduino:endpoint message
[?] What will the url of your endpoint be? /api/messages
Produces:
server/message.router.js
server/message.controller.js
Generates a new route.
Example:
yo angular-arduino:route myroute
[?] Where would you like to create this route? client/app/
[?] What will the url of your route be? /myroute
Produces:
client/app/myroute/myroute.js
client/app/myroute/myroute.controller.js
client/app/myroute/myroute.controller.spec.js
client/app/myroute/myroute.html
client/app/myroute/myroute.scss
Generates a controller.
Example:
yo angular-arduino:controller user
[?] Where would you like to create this controller? client/app/
Produces:
client/app/user/user.controller.js
client/app/user/user.controller.spec.js
Generates a directive.
Example:
yo angular-arduino:directive myDirective
[?] Where would you like to create this directive? client/app/
[?] Does this directive need an external html file? Yes
Produces:
client/app/myDirective/myDirective.directive.js
client/app/myDirective/myDirective.directive.spec.js
client/app/myDirective/myDirective.html
client/app/myDirective/myDirective.scss
Simple directive without an html file
Example:
yo angular-arduino:directive simple
[?] Where would you like to create this directive? client/app/
[?] Does this directive need an external html file? No
Produces:
client/app/simple/simple.directive.js
client/app/simple/simple.directive.spec.js
Generates a filter.
Example:
yo angular-arduino:filter myFilter
[?] Where would you like to create this filter? client/app/
Produces:
client/app/myFilter/myFilter.filter.js
client/app/myFilter/myFilter.filter.spec.js
Generates an AngularJS service.
Example:
yo angular-arduino:service myService
[?] Where would you like to create this service? client/app/
Produces:
client/app/myService/myService.service.js
client/app/myService/myService.service.spec.js
You can also do yo angular-arduino:factory
and yo angular-arduino:provider
for other types of services.
Generates an AngularJS service decorator.
Example:
yo angular-arduino:decorator serviceName
[?] Where would you like to create this decorator? client/app/
Produces
client/app/serviceName/serviceName.decorator.js
The following packages are always installed by the app generator:
- angular
- angular-mocks
- angular-resource
- angular-sanitize
- angular-scenario
- jquery
These packages are installed optionally depending on your configuration:
- angular-route
- angular-ui-router
- angular-bootstrap
- bootstrap
In index.html all dependencies are linked from CDN. Bower components are installed locally as a dev dependencies for running tests.
You can install bower components as normal dependencies but this will consume lots of valuable software memory.
Yeoman generated projects can be further tweaked according to your needs by modifying project files appropriately.
A .yo-rc
file is generated for helping you copy configuration across projects, and to allow you to keep track of your settings. You can change this as you see fit.
Running grunt test
will run the client tests with karma and mocha.
Overview
├── client
│ ├── app - All of our app specific components go in here
│ ├── assets - Custom assets: fonts, images, etc…
│ └── components - Our reusable components, non-specific to to our app
│
└── server
└── server.ino - Our main server Arduino sketch
An example client component in client/app
main
├── main.js - Routes
├── main.controller.js - Controller for our main route
├── main.controller.spec.js - Test
├── main.html - View
└── main.less - Styles
An example server component in server
├── thing.route.ino - Routes
└── thing.controller.ino - Controller for our `thing` endpoint
See the contributing docs
When submitting an issue, please follow the guidelines. Especially important is to make sure Yeoman is up-to-date, and providing the command or commands that cause the issue.
When submitting a PR, make sure that the commit messages match the AngularJS conventions.
When submitting a bugfix, try to write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix.
When submitting a new feature, add tests that cover the feature.
See the travis.yml
for configuration required to run tests.