Additions/cleanup to README.md

This commit is contained in:
Andrew Stewart 2013-10-22 14:18:31 -07:00
parent bc9dd05cbc
commit 719790fc80
1 changed files with 25 additions and 12 deletions

View File

@ -3,20 +3,26 @@
A JavaScript framework for robotics and physical computing using node.js and nactor A JavaScript framework for robotics and physical computing using node.js and nactor
## Getting Started ## Getting Started
Install the module with: `npm install cylon` Install the module with: `npm install cylon`
## Examples ## Examples
**Note:** before running examples in the `examples/` dir, make sure to compile
the source with `grunt coffee` first.
### Javascript:
```javascript ```javascript
var cylon = require("cylon"); var cylon = require("cylon");
// Initialize the robot // Initialize the robot
var robot = cylon.robot({ var robot = cylon.robot({
connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' },
device: { name: 'led', driver: 'led', pin: 13 }, device: { name: 'led', driver: 'led', pin: 13 },
work: function() { work: function() {
// we do our thing here // we do our thing here
every(1.second(), function() { led.toggle(); }); every((1).second(), function() { led.toggle(); });
} }
}); });
@ -24,20 +30,25 @@ var robot = cylon.robot({
robot.start(); robot.start();
``` ```
### CoffeeScrip:
```coffee-script ```coffee-script
cylon = require("cylon") cylon = require "cylon"
# Initialize the robot # Initialize the robot
robot = cylon.robot robot = cylon.robot
connection: connection:
name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' name: 'arduino'
device: adaptor: 'firmata'
name: 'led', driver: 'led', pin: 13 port: '/dev/ttyACM0'
device:
name: 'led'
driver: 'led'
pin: 13
work: -> work: ->
# we do our thing here # we do our thing here
every 1.second, -> every 1.second, -> led.toggle
led.toggle
robot.start robot.start
``` ```
@ -46,7 +57,9 @@ robot.start
_(Coming soon)_ _(Coming soon)_
## Contributing ## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). In lieu of a formal styleguide, take care to maintain the existing coding style.
Add unit tests for any new or changed functionality. Lint and test your code
using [Grunt](http://gruntjs.com/).
## Release History ## Release History
_(Nothing yet)_ _(Nothing yet)_