Cyclon

Bibliothèques Javascript Node.js pour créer des programmes robotiques.

=Installation= node install cyclon sudo npm install -g cylon-cli

=Démarrage rapide avec un Arduino= Branchez un Arduino sur votre machine.

Au moyen de l'IDE Arduino, Installez le sketch FirmataStandard qui est fourni dans les exemples.

Remarque : vous pouvez installer Firmata sur l'Arduino en utilisant l'utilitaire en ligne de commande Gort.

Lisez https://github.com/voodootikigod/node-serialport#to-install

Utilisez Gort pour déterminer le port série de l'Arduino.

Sur l'hôte (PC Win/Linux, Mac, RPI, BBB, Edison), exécutez le programme suivant npm install serialport npm install cyclon-firmata

$GORT_HOME/gort scan serial node arduino.js /dev/ttyACM0

arduino.js var Cylon = require('cylon');

Cylon.robot({ connection: {    name: 'arduino',    adaptor: 'firmata',    port: process.argv[2] // must be changed according $GORT_HOME/gort scan serial ('/dev/ttyACM0', ...)  },

devices: [ { name: 'led', driver: 'led', pin: 13 }, { name: 'button', driver: 'button', pin: 2 } ],

work: function(my) { my.button.on('push', function {     my.led.toggle    }); } }).start;

=Autre=

Espeak
http://cylonjs.com/documentation/platforms/speech/ brew install https://raw.githubusercontent.com/hybridgroup/cylon-speech/5f32fb3df8fe7031213849f52b14cad5e9846691/lib/espeak.rb espeak "This is awesome, OS X speaking" npm install cylon-speech node speech.js

speech.js var Cylon = require('cylon');

Cylon.robot({ // voice for espeak can be specified either in one string or as params for the adaptor.  // both connections below will reproduce with the same voice.  // connection: { name: 'speech', adaptor: 'speech', language: 'en, gender: 'f', 'voice: '3' },  connection: { name: 'speech', adaptor: 'speech', voice: 'en-f3', speed: 130 },  device: { name: 'mouth', driver: 'speech' },

work: function(my) { my.mouth.say("This is awesome!"); my.mouth.say("I'm a Cylon.JS robot, and I'm talking!"); } }).start;

MQTT
http://cylonjs.com/documentation/platforms/mqtt/ npm install cylon-mqtt node mqtt.js

mqtt.js var Cylon = require('cylon');

Cylon.robot({ connection: { name: 'server', adaptor: 'mqtt', host: 'mqtt://test.mosquitto.org:1883' },

work: function(my) { my.server.subscribe('cyclon/test');

my.server.on('message', function (topic, data) {     console.log(topic + ": " + data);    });

every((1).seconds, function {     my.server.publish('cyclon/test', 'Hello Cyclon');    }); } }).start;