Skip to content

hybridgroup/cylon-example-chrome

Repository files navigation

Cylon.JS - Browserify Example

This repo contains an example of running Cylon.JS in the browser, using the Browserify tool and a Chrome App to allow for serialport access.

It includes a custom Cylon logger to log messages directly to the page.

Building

This example is built with Browserify. To write your robot's code, modify script.js.

Then, when you want to run it in the browser, you need to run it through Browserify.

First, install dependencies:

$ npm install

Then, use browserify to compile your Cylon code:

$ ./node_modules/.bin/browserify -r cylon-gpio -r cylon-i2c -r cylon-firmata script.js > ./js/robot.js

This command can also be run with make.

Running

To run your Chrome app, load it as an unpacked extension in Chrome. This .video explains the process:

More modules

If you start using additional Cylon modules, such as cylon-leapmotion, etc., you'll need to manually specify them to browserify when building your robot.

$ ./node_modules/.bin/browserify -r cylon-leapmotion script.js > js/script.js

This is due to the dynamic loading of modules Cylon does, which Browserify cannot automatically detect.

About

Cylon.JS example, running in a Chrome app.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published