"use strict"; // allow production modules to expose internal // functions and properties for testing process.env.NODE_ENV = "test"; var path = require("path"); var chai = require("chai"); var sinonChai = require("sinon-chai"); var Cylon = require("cylon"); Cylon.config({ logging: { logger: false }}); global.chai = chai; global.should = chai.should(); global.expect = chai.expect; global.assert = chai.assert; global.AssertionError = chai.AssertionError; global.sinon = require("sinon"); global.spy = sinon.spy; global.stub = sinon.stub; // can be used by test modules to require production modules, // relative to the base path (where the Gruntfile.js also lives) global.lib = function(src) { var resource = path.normalize("../lib/" + src); return require(resource); }; // can be used when you expect a function to throw an error global.err = function(fn, msg) {
async = require('async'); var LightStrip = require('./lightstrip'); function rgbToHex(r, g, b) { return ((1 << 24) + (r << 16) + (g << 8) + (b)) & 0xffffff; } function randomNumber() { return Math.floor(Math.random() * 255) } Cylon.config({ api: { ssl: false, port: '8080', host: '0.0.0.0', } }); Cylon.api(); Cylon.robot({ name: "DF14-Game", gameRunning: false, players: ['',''], connections: [ { name: 'sphero1', adaptor: 'sphero', port: '/dev/rfcomm0' }, { name: 'sphero2', adaptor: 'sphero', port: '/dev/rfcomm1' },
// watch-sphero.js /* * Control sphero with pebble watch * */ var Cylon = require('cylon'); var speed = 0; var heading = 0; Cylon.config({ api: { host: '0.0.0.0', port: '8080', ssl: false } }); Cylon.api(); Cylon.robot({ name: 'hello', connection: { name: 'pebble', adaptor: 'pebble' }, device: { name: 'pebble',
}, speed: constants.maxSpeed, accel: constants.acceleration, decel: constants.deceleration }); lightSensor = new five.Sensor({ pin: "A0", limit: [constants.lightLowerLimit, constants.lightUpperLimit] }); }); // Initialize the robot with Cylon } else { Cylon.config({ logging: { level: 'debug' } }); Cylon.robot({ name: "B15", connections: { arduino: { adaptor: 'firmata', port: 'COM5' } }, devices: { stepperRight: { driver: 'stepper', driveType: 1, stepsPerRevolution: constants.stepsPerRotation, deviceNum: 0,