Cyclon: Difference between revisions

From air
Jump to navigation Jump to search
(Created page with "Bibliothèques Javascript Node.js pour créer des programmes robotiques. =Installation= <pre> node install cyclon sudo npm install -g cylon-cli </pre> <pre> brew inst...")
 
Line 8: Line 8:
sudo npm install -g cylon-cli
sudo npm install -g cylon-cli
</pre>
</pre>


<pre>
brew install https://raw.githubusercontent.com/hybridgroup/cylon-speech/5f32fb3df8fe7031213849f52b14cad5e9846691/lib/espeak.rb
espeak "This is awesome, OS X speaking"

</pre>



=Démarrage rapide avec un [[Arduino]]=
=Démarrage rapide avec un [[Arduino]]=

Revision as of 07:08, 9 November 2014

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.

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();