Wednesday, 19 July, 2017 UTC


Summary

Introduction to Cylon.js
Cylon.js is an upcoming Robotic framework written in JavaScript and is available at the npm(Node Package Manager). It supports almost 36 different platforms and is really awesome to work with. It helps you to do physical computing and also enables us with IOT.It supports I2C(Inter Integrated Circuits) using the cylon-i2c module. It has an unbiased support for MQTTHTTP, and SocketIO. It is easy to use since it supports declarative syntax but on the other hand, it also has a Fluent way of programming which is being adopted by the developers at a good pace.
So if you have ever had a dream to build a bot or may be a machine to fly. This should be your choice of technology.It is really simple to install since it uses npm.
Installation of Cylon.js
Use the following command to get started with Cylon.js Installation.
npm install cylon
Simple Bling Program with LED
This give code will work with Arduino so let’s see the piece of code.
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();
As we move ahead the last step will comprise of the following, this will help us to compile and run the code.
npm install cylon-firmata cylon-gpio cylon-i2c
node script.js
You can look at the exhaustive tutorials here. You can also try the other framework out here in this particular tutorial.
 
The post Cylon.js – A JavaScript Robotic Framework appeared first on The Web Juice.