diff --git a/README.markdown b/README.markdown index 2b12b0c..ef7da6c 100644 --- a/README.markdown +++ b/README.markdown @@ -84,16 +84,16 @@ Cylon.robot({ var Cylon = require('cylon'); Cylon.robot({ - connections: [ - { name: 'digispark', adaptor: 'digispark'}, - { name: 'leapmotion', adaptor: 'leapmotion' } - ], + connections: { + digispark: { adaptor: 'digispark' }, + leapmotion: { adaptor: 'leapmotion' } + }, - devices: [ - { name: 'servo1', driver: 'servo', pin: 0, connection: 'digispark' }, - { name: 'servo2', driver: 'servo', pin: 1, connection: 'digispark' }, - { name: 'leapmotion', driver: 'leapmotion', connection: 'leapmotion' } - ], + devices: { + servo1: { driver: 'servo', pin: 0, connection: 'digispark' }, + servo2: { driver: 'servo', pin: 1, connection: 'digispark' }, + leapmotion: { driver: 'leapmotion', connection: 'leapmotion' } + }, work: function(my) { my.x = 90; diff --git a/examples/arduinos_and_skynet/multiple_arduinos_one_skynet_connection.js b/examples/arduinos_and_skynet/multiple_arduinos_one_skynet_connection.js index 1953854..beaae24 100644 --- a/examples/arduinos_and_skynet/multiple_arduinos_one_skynet_connection.js +++ b/examples/arduinos_and_skynet/multiple_arduinos_one_skynet_connection.js @@ -15,11 +15,12 @@ Arduino = (function(){ })(); skynet = { - connections: [ - { name: 'skynet', - adaptor: 'skynet', - uuid: "96630051-a3dc-11e3-8442-5bf31d98c912", token: "2s67o7ek98pycik98f43reqr90t6s9k9" } - ], + connection: { + name: 'skynet', + adaptor: 'skynet', + uuid: "96630051-a3dc-11e3-8442-5bf31d98c912", + token: "2s67o7ek98pycik98f43reqr90t6s9k9" + }, work: function(my) { console.log("Skynet is listening..."); diff --git a/examples/cattoy/cattoy.js b/examples/cattoy/cattoy.js index 3b0161f..e356215 100644 --- a/examples/cattoy/cattoy.js +++ b/examples/cattoy/cattoy.js @@ -1,16 +1,16 @@ var Cylon = require('../..'); Cylon.robot({ - connections: [ - { name: 'digispark', adaptor: 'digispark'}, - { name: 'leapmotion', adaptor: 'leapmotion' } - ], + connections: { + digispark: { adaptor: 'digispark' }, + leapmotion: { adaptor: 'leapmotion' } + }, - devices: [ - {name: 'servo1', driver: 'servo', pin: 0, connection: 'digispark'}, - {name: 'servo2', driver: 'servo', pin: 1, connection: 'digispark'}, - {name: 'leapmotion', driver: 'leapmotion', connection: 'leapmotion'} - ], + devices: { + servo1: { driver: 'servo', pin: 0, connection: 'digispark' }, + servo2: { driver: 'servo', pin: 1, connection: 'digispark' }, + leapmotion: { driver: 'leapmotion', connection: 'leapmotion' } + }, work: function(my) { my['x'] = 90; diff --git a/examples/cattoy/cattoy.markdown b/examples/cattoy/cattoy.markdown index f5823b5..a47a501 100644 --- a/examples/cattoy/cattoy.markdown +++ b/examples/cattoy/cattoy.markdown @@ -10,16 +10,16 @@ Now that we have Cylon imported, we can start defining our robot Let's define the connections and devices: - connections: [ - { name: 'digispark', adaptor: 'digispark'}, - { name: 'leapmotion', adaptor: 'leapmotion' } - ], + connections: { + digispark: { adaptor: 'digispark' }, + leapmotion: { adaptor: 'leapmotion' } + }, - devices: [ - {name: 'servo1', driver: 'servo', pin: 0, connection: 'digispark'}, - {name: 'servo2', driver: 'servo', pin: 1, connection: 'digispark'}, - {name: 'leapmotion', driver: 'leapmotion', connection: 'leapmotion'} - ], + devices: { + servo1: { driver: 'servo', pin: 0, connection: 'digispark' }, + servo2: { driver: 'servo', pin: 1, connection: 'digispark' }, + leapmotion: { driver: 'leapmotion', connection: 'leapmotion' } + }, Now that Cylon knows about the necessary hardware we're going to be using, we'll tell it what work we want to do: diff --git a/examples/leap_ardrone/leap_ardrone.js b/examples/leap_ardrone/leap_ardrone.js index 095e301..fa08b91 100644 --- a/examples/leap_ardrone/leap_ardrone.js +++ b/examples/leap_ardrone/leap_ardrone.js @@ -25,17 +25,17 @@ var handStartPosition = [], var handWasClosedInLastFrame = false; Cylon.robot({ - connections: [ - { name: 'leapmotion', adaptor: 'leapmotion' }, - { name: 'ardrone', adaptor: 'ardrone', port: '192.168.1.1' }, - { name: 'keyboard', adaptor: 'keyboard' } - ], + connections: { + leapmotion: { adaptor: 'leapmotion' }, + ardrone: { adaptor: 'ardrone', port: '192.168.1.1' }, + keyboard: { adaptor: 'keyboard' } + }, - devices: [ - { name: 'drone', driver: 'ardrone', connection: 'ardrone' }, - { name: 'leapmotion', driver: 'leapmotion', connection: 'leapmotion' }, - { name: 'keyboard', driver: 'keyboard', connection: 'keyboard'} - ], + devices: { + drone: { driver: 'ardrone', connection:'ardrone' }, + leapmotion: { driver: 'leapmotion', connection:'leapmotion' }, + keyboard: { driver: 'keyboard', connection:'keyboard' } + }, work: function(my) { my.keyboard.on('right', my.drone.rightFlip); diff --git a/examples/leap_ardrone/leap_ardrone.markdown b/examples/leap_ardrone/leap_ardrone.markdown index 8dda291..fcc7abd 100644 --- a/examples/leap_ardrone/leap_ardrone.markdown +++ b/examples/leap_ardrone/leap_ardrone.markdown @@ -12,16 +12,17 @@ Now that we have Cylon imported, we can start defining our robot Let's define the connections and devices: - connections: [ - { name: 'leapmotion', adaptor: 'leapmotion' }, - { name: 'ardrone', adaptor: 'ardrone', port: '192.168.1.1' }, - { name: 'keyboard', adaptor: 'keyboard' } - ], - devices: [ - { name: 'drone', driver: 'ardrone', connection:'ardrone' }, - { name: 'leapmotion', driver: 'leapmotion', connection:'leapmotion' }, - { name: 'keyboard', driver: 'keyboard', connection:'keyboard'} - ], + connections: { + leapmotion: { adaptor: 'leapmotion' }, + ardrone: { adaptor: 'ardrone', port: '192.168.1.1' }, + keyboard: { adaptor: 'keyboard' } + }, + + devices: { + drone: { driver: 'ardrone', connection:'ardrone' }, + leapmotion: { driver: 'leapmotion', connection:'leapmotion' }, + keyboard: { driver: 'keyboard', connection:'keyboard' } + }, Now that Cylon knows about the necessary hardware we're going to be using, we'll tell it what work we want to do: diff --git a/examples/leap_arduino/leap_arduino.js b/examples/leap_arduino/leap_arduino.js index 830fa12..8a0205e 100644 --- a/examples/leap_arduino/leap_arduino.js +++ b/examples/leap_arduino/leap_arduino.js @@ -1,11 +1,15 @@ var Cylon = require('../..'); Cylon.robot({ - connections: [{ name: 'leapmotion', adaptor: 'leapmotion' }, - { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }], + connections: { + arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' } + leapmotion: { adaptor: 'leapmotion' }, + }, - devices: [{ name: 'leapmotion', driver: 'leapmotion', connection: 'leapmotion' }, - { name: 'led', driver: 'led', pin: 13, connection: 'arduino' }], + devices: { + led: { driver: 'led', pin: 13, connection: 'arduino' } + leapmotion: { driver: 'leapmotion', connection: 'leapmotion' }, + }, work: function(my) { my.leapmotion.on('frame', function(frame) { diff --git a/examples/leap_arduino/leap_arduino.markdown b/examples/leap_arduino/leap_arduino.markdown index 8d96181..0682a7f 100644 --- a/examples/leap_arduino/leap_arduino.markdown +++ b/examples/leap_arduino/leap_arduino.markdown @@ -10,15 +10,15 @@ Now that we have Cylon imported, we can start defining our robot Let's define the connections and devices: - connections: [ - { name: 'leapmotion', adaptor: 'leapmotion' }, - { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' } - ], + connections: { + leapmotion: { adaptor: 'leapmotion' }, + arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' } + }, - devices: [ - { name: 'leapmotion', driver: 'leapmotion', connection: 'leapmotion' }, - { name: 'led', driver: 'led', pin: 13, connection: 'arduino' } - ], + devices: { + leapmotion: { driver: 'leapmotion', connection: 'leapmotion' }, + led: { driver: 'led', pin: 13, connection: 'arduino' } + }, Now that Cylon knows about the necessary hardware we're going to be using, we'll tell it what work we want to do: diff --git a/examples/rapiro/rapiro_servo.js b/examples/rapiro/rapiro_servo.js index 521fc0b..2942393 100644 --- a/examples/rapiro/rapiro_servo.js +++ b/examples/rapiro/rapiro_servo.js @@ -2,8 +2,10 @@ var Cylon = require('../..'); Cylon.robot({ connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyUSB0' }, - devices: [{name: 'led', driver: 'led', pin: 17}, - { name: 'servo', driver: 'servo', pin: 2, range: { min: 30, max: 150 } }], + devices: { + led: { driver: 'led', pin: 17 }, + servo: { driver: 'servo', pin: 2, range: { min: 30, max: 150 } } + }, work: function(my) { my.led.turnOn(); diff --git a/examples/skynet/skynet-blink.js b/examples/skynet/skynet-blink.js index 89ab014..09c3500 100644 --- a/examples/skynet/skynet-blink.js +++ b/examples/skynet/skynet-blink.js @@ -1,11 +1,14 @@ var Cylon = require('../..'); Cylon.robot({ - connections: [ - { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' }, - { name: 'skynet', adaptor: 'skynet', - uuid: "96630051-a3dc-11e3-8442-5bf31d98c912", token: "2s67o7ek98pycik98f43reqr90t6s9k9" } - ], + connections: { + arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' }, + skynet: { + adaptor: 'skynet', + uuid: "96630051-a3dc-11e3-8442-5bf31d98c912", + token: "2s67o7ek98pycik98f43reqr90t6s9k9" + } + }, device: { name: 'led13', driver: 'led', pin: 13, connection: 'arduino' }, diff --git a/examples/skynet/skynet-blink.markdown b/examples/skynet/skynet-blink.markdown index eb36817..ee1e867 100644 --- a/examples/skynet/skynet-blink.markdown +++ b/examples/skynet/skynet-blink.markdown @@ -10,19 +10,14 @@ Now that we have Cylon imported, we can start defining our robot Let's define the connections and devices: - connections: [ - { - name: 'arduino', - adaptor: 'firmata', - port: '/dev/ttyACM0' - }, - { - name: 'skynet', + connections: { + arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' }, + skynet: { adaptor: 'skynet', uuid: "96630051-a3dc-11e3-8442-5bf31d98c912", token: "2s67o7ek98pycik98f43reqr90t6s9k9" } - ], + }, device: { name: 'led13', driver: 'led', pin: 13, connection: 'arduino' },