Examples

Arduino

In this example below, we will use Cylon.js with an Arduino controlled via the Firmata protocol. First, install the cylon-firmata module:

$ npm install cylon-firmata

Now, this example code will connect to an Arduino, and every second turn the LED either on, or off.

var Cylon = require("cylon");

// Initialize the robot
var robot = Cylon.robot({
  // Change the port to the correct port for your Arduino.
  connection: { name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0' },
  device: { name: 'led', driver: 'led', pin: 13 },

  work: function(my) {
    // we do our thing here
    every((1).second(), function() { my.led.toggle(); });
  }
});

// start working
robot.start();

More Examples

We've got lots more examples here to help you get started.

Platform Support

Cylon.js has a extensible system for connecting to hardware devices. The following robotics and physical computing systems, and software platforms, are currently supported:

Support for many devices that use General Purpose Input/Output (GPIO) have a shared set of drivers provided using the cylon-gpio module:

Support for devices that use Inter-Integrated Circuit (I2C) have a shared set of drivers provded using the cylon-i2c module:

API

Cylon has a built-in API that you can interact with your robots.

All you need to start up the API server is to place the following command in your .js file after you require Cylon.

var Cylon = require("cylon");
Cylon.api();

Then visit https://localhost:3000/ and you are ready to control your robots from a web browser!

You can check out more information on the Cylon API in the docs here.

CLI

Cylon uses the Gort toolkit, so you can access important features from the command line. You can scan, connect to devices, update firmware, and more! We call it "RobotOps", a.k.a. "DevOps for Robotics".

Cylon also has it's own CLI tool to generate new modules, robots, and drivers.

You can check out the Cylon CLI docs here.

Be Part of the Robot Evolution

If you'd like to find out more, you can check out our code on GitHub.

Want updates on what we're working on, follow us on Twitter, or check out our Trello board.

If you want to talk to us, we can be found hanging out on IRC, #cylon on irc.freenode.net