The "Hello, World" Of Things

This example will connect to an Arduino, and toggle an LED every one second.

var Cylon = require("cylon");

// Initialize the robot
Cylon.robot({
  // Change the port to the correct port for your Arduino.
  connections: {
    arduino: { adaptor: 'firmata', port: '/dev/ttyACM0' }
  },

  devices: {
    led: { driver: 'led', pin: 13 }
  },

  work: function(my) {
    every((1).second(), function() {
      my.led.toggle();
    });
  }
}).start();

To run it:

$ npm install cylon-firmata cylon-gpio cylon-i2c
$ node script.js

We've got lots more examples here to help you get started on your next IoT project.

Platform Support

Cylon.js has an 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:

User Created Platforms

In addition to our officially supported platforms, our wonderful users have created the following platforms:

Parrot Rolling Spider
PCDuino
iBeacon
Belkin Wemo
Telegram
APC UPS
Myo

If you have another platform you would like to add, please send us a pull request.

Browser & Mobile Support

Cylon.js can be run directly in-browser, using the browserify NPM module. You can also run it from within a Chrome connected app, or a PhoneGap mobile app.

For more info on browser support, and for help with different configurations, you can find more info in our docs.

API

Cylon.js features an API plugin system which enables you to send commands, stream real time data, and monitor the overall state of your robots. We currently support the following API plugins:

The Cylon.js HTTP plugin, for instance, allows you to interact with your robots over HTTP. You simply install the API plugin alongside Cylon.js with npm:

$ npm install cylon-api-http

Then, all you need to do is place the following command in your Cylon.js program:

var Cylon = require("cylon");

Cylon.api('http');

Once your Cylon.js program is running, visit https://localhost:3000/ and you're 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

  • Want updates on what we're working on? Follow us on Twitter.

  • Get involved with Cylon.js projects, ask questions, or stay up to date with the latest Cylon.js news on our mailing list!

  • If you'd like to find out more, check out our code on GitHub. You can also open a new issue if you need help, feel we can improve something, or have a feature suggestion.

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

Ready to build the next big thing with JavaScript?

Get Started