Fix example and globally namespace utility functions

This commit is contained in:
Andrew Stewart 2013-10-22 14:07:15 -07:00
parent 2e74b8bdef
commit bc9dd05cbc
3 changed files with 7 additions and 7 deletions

View File

@ -1,13 +1,13 @@
var cylon = require("cylon");
var cylon = require('..');
// Initialize the robot
var robot = cylon.robot({
connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' },
device: { name: 'led', driver: 'led', pin: 13 },
work: function() {
// we do our thing here
every(1.second(), function() { console.log("ehlo"); });
every((1).second(), function() { console.log("ehlo"); });
}
});

View File

@ -9,7 +9,7 @@
'use strict';
Robot = require("./robot")
utils = require('./utils')
require('./utils')
exports.robot = (opts = {}) ->
opts.master = this

View File

@ -15,7 +15,7 @@
# Returns an interval
# Examples:
# every(10.seconds(), -> console.log("hello world (and again in 5 seconds)!"))
exports.every = (interval, action) ->
global.every = (interval, action) ->
setInterval action, interval
# Public: Alias to setTimeout, combined with Number monkeypatches below to
@ -27,7 +27,7 @@ exports.every = (interval, action) ->
# Returns an interval
# Examples:
# after(10.seconds(), -> console.log("hello world from ten seconds ago!"))
exports.after = (delay, action) ->
global.after = (delay, action) ->
setTimeout action, delay
Number::seconds = ->