Giter Site home page Giter Site logo

cylon-tessel's Introduction

Cylon.js For Tessel

Cylon.js (http://cylonjs.com) is a JavaScript framework for robotics and physical computing using Node.js

This repository contains the Cylon adaptor for the Tessel JavaScript microcontroller.

Want to use Ruby on robots? Check out our sister project Artoo (http://artoo.io)

Want to use the Go programming language to power your robots? Check out our sister project Gobot (http://gobot.io).

Build Status Code Climate Test Coverage

For more information about Cylon, check out our repo at https://github.com/hybridgroup/cylon

How to Install

Follow the installation instructions detailed here

We've provided a repo containing an example cylon-tessel project.

$ git clone https://github.com/hybridgroup/cylon-example-tessel.git my-tessel-project
$ cd my-tessel-project
$ npm install
$ tessel run blink.js

If the blue light starts to blink, then you're all set!

How to Use

LED

This small program lets you toggle an LED on and off.

var Cylon = require('cylon');

Cylon.robot({
  connections: {
    tessel: { adaptor: 'tessel' }
  },

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

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

Climate

This small program shows how to use the Tessel Climate module.

var Cylon = require('cylon');

Cylon.robot({
  connections: {
    tessel: { adaptor: 'tessel', port: 'A' }
  },

  devices: {
    climate: { driver: 'climate-si7005' }
  },

  work: function(my) {
    my.climate.on('error', function (err) {
      console.log(err)
    });

    every((1).seconds(), function() {
      my.climate.readHumidity(function (err, humid) {
        console.log('Humidity:', humid.toFixed(4) + '%RH');
      });
      my.climate.readTemperature('f', function (err, temp) {
        console.log('Degrees:', temp.toFixed(4) + 'F');
      });
    });
  }
}).start();

How to Connect

As mentioned in the How To Install section, connecting to the Tessel is easy. You just need to follow the provided instructions on the Tessel site.

If you've already done this, your Tessel should already be connected and ready to run Cylon.JS code.

Tessel Module Support

The Tessel has a variety of custom hardware modules specifically for use with Tessel. Cylon.js has support for the following Tessel modules:

GPIO & I2C Support

In addition to the custom Tessel modules, you can also use the standard Cylon.js GPIO and I2C drivers:

  • GPIO <=> Drivers

    • Analog Sensor
    • Button
    • IR Rangefinder
    • LED
    • MakeyButton
    • Maxbotix Ultrasonic Range Finder
  • I2C <=> Drivers

    • BlinkM
    • BMP180
    • HMC6352 Digital Compass
    • LCD
    • MPL115A2 Barometer/Thermometer
    • MPU6050

Documentation

We're busy adding documentation to our web site at http://cylonjs.com/ please check there as we continue to work on Cylon.js

Thank you!

Contributing

For our contribution guidelines, please go to https://github.com/hybridgroup/cylon/blob/master/CONTRIBUTING.md.

Release History

For the release history, please go to https://github.com/hybridgroup/cylon-tessel/blob/master/RELEASES.md.

License

Copyright (c) 2013-2015 The Hybrid Group. Licensed under the Apache 2.0 license.

cylon-tessel's People

Contributors

deadprogram avatar edgarsilva avatar rafmagana avatar stewart avatar zankavrogin avatar zankich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cylon-tessel's Issues

Issue running LED test script

When running the following installation/test commands;

$ sudo npm install -g cylon-cli
$ cylon generate tessel my-teasel-project
$ cd my-teasel-project
$ npm install
$ tessel run blink.js

I'm consistently presented with the following output;

I, [2014-09-06T09:12:01.377Z] INFO -- : Initializing connections.
I, [2014-09-06T09:12:01.405Z] INFO -- : Initializing connection 'tessel'.
D, [2014-09-06T09:12:01.433Z] EBUG -- : Loading adaptor 'tessel'.
D, [2014-09-06T09:12:14.163Z] EBUG -- : Registering Tessel adaptor for Robot 34012
D, [2014-09-06T09:12:14.188Z] EBUG -- : Registering ambient-attx4 Driver for Robot 34012
D, [2014-09-06T09:12:14.240Z] EBUG -- : Registering accel-mma84 Driver for Robot 34012
D, [2014-09-06T09:12:14.292Z] EBUG -- : Registering audio-vs1053b Driver for Robot 34012
D, [2014-09-06T09:12:14.345Z] EBUG -- : Registering camera-vc0706 Driver for Robot 34012
D, [2014-09-06T09:12:14.397Z] EBUG -- : Registering climate-si7005 Driver for Robot 34012
D, [2014-09-06T09:12:14.449Z] EBUG -- : Registering gps-a2235h Driver for Robot 34012
D, [2014-09-06T09:12:14.501Z] EBUG -- : Registering servo-pca9685 Driver for Robot 34012
D, [2014-09-06T09:12:14.553Z] EBUG -- : Registering relay-mono Driver for Robot 34012
D, [2014-09-06T09:12:14.605Z] EBUG -- : Registering ir-attx4 Driver for Robot 34012
D, [2014-09-06T09:12:14.657Z] EBUG -- : Registering ble-ble113a Driver for Robot 34012
D, [2014-09-06T09:12:14.990Z] EBUG -- : Registering i2c BlinkM driver for Robot 34012
D, [2014-09-06T09:12:15.041Z] EBUG -- : Registering i2c HMC6352 driver for Robot 34012
D, [2014-09-06T09:12:15.092Z] EBUG -- : Registering i2c MPL115A2 driver for Robot 34012
D, [2014-09-06T09:12:15.143Z] EBUG -- : Registering i2c BMP180 driver for Robot 34012
D, [2014-09-06T09:12:15.194Z] EBUG -- : Registering i2c MPU6050 driver for Robot 34012
D, [2014-09-06T09:12:15.245Z] EBUG -- : Registering i2c LCD driver for Robot 34012
I, [2014-09-06T09:12:15.317Z] INFO -- : Initializing devices.
I, [2014-09-06T09:12:15.345Z] INFO -- : Initializing device 'led'.
D, [2014-09-06T09:12:15.378Z] EBUG -- : Loading driver 'led'.
I, [2014-09-06T09:12:15.464Z] INFO -- : Starting connections.
I, [2014-09-06T09:12:15.502Z] INFO -- : Connecting to 'tessel'.
D, [2014-09-06T09:12:15.528Z] EBUG -- : Connecting to Tessel 'tessel'...
I, [2014-09-06T09:12:15.553Z] INFO -- : Connecting to adaptor 'tessel'.
I, [2014-09-06T09:12:15.589Z] INFO -- : Starting devices.
I, [2014-09-06T09:12:15.626Z] INFO -- : Starting device 'led' on pin 1.
I, [2014-09-06T09:12:15.651Z] INFO -- : Driver led started.
I, [2014-09-06T09:12:15.689Z] INFO -- : Working.
/app/blink.js:8: attempt to call method 'toggle' (a nil value)

Tessel Versions

tessel version        
INFO v0.3.13
tessel version --board
TESSEL! Connected to <DEVICE_ID>
INFO Serial #: <SERIAL>
INFO Wifi Version: 1.28
INFO Firmware Commit: d378c4b
INFO Runtime Commit: a9151ad

When cylon-tessel is deployed, no modules are bundled with it.

Right now the very gaudy CLI command DEBUG=* tessel pack . -d exposes that only these modules are deployed to Tessel:

➜  cylon-tessel git:(master) DEBUG=* tessel pack -d examples/blink.js
  tessel compiling +0ms _start.js
  tessel writing +26ms _start.js
  tessel compiling +1ms app/examples/blink.js
  tessel writing +8ms app/examples/blink.js
  tessel compiling +1ms app/lib/cylon-tessel.js
  tessel writing +10ms app/lib/cylon-tessel.js
  tessel compiling +0ms app/lib/tessel.js
  tessel writing +64ms app/lib/tessel.js
INFO wrote 31.00 KB bytes
➜  cylon-tessel git:(master)

The culprit is https://github.com/hybridgroup/cylon-tessel/blob/master/package.json#L19. "*": false, makes no modules included by default, but I had to add "cylon": true to explicitly require it again.

npm install failed

Seem to be getting this error when trying to install the cylon-tessel package:

Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the usb package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build

Tried on node v5.3.0 & v4.2.4

Ambient module problem

Hi!

I am trying to run the tessel with an Ambient module, I copied the example code, but I get:

$ node amb1.js
I, [2014-07-07T18:49:01.478Z]  INFO -- : Initializing connections.
I, [2014-07-07T18:49:01.480Z]  INFO -- : Initializing connection 'tessel'.
D, [2014-07-07T18:49:01.481Z] DEBUG -- : Loading adaptor 'tessel'.
Cannot find the 'cylon-tessel' module. Please install it with 'npm install cylon-tessel' and try again.

While in my node_modules directory I have:

 ls -ltr node_modules/
total 0
drwxr-xr-x  14 pmu  staff  476 Jul  7 20:47 cylon
drwxr-xr-x  13 pmu  staff  442 Jul  7 20:48 cylon-tessel
drwxr-xr-x  13 pmu  staff  442 Jul  7 20:48 cylon-i2c
drwxr-xr-x  13 pmu  staff  442 Jul  7 20:48 cylon-gpio

LED test script error

I am trying to run LED sample program and followed following steps

$ cylon generate tessel my-tessel-project
$ cd my-tessel-project
$ npm install
$ tessel run blink.js

TESSEL! Connected to TM-00-04-f000da30-005d4f38-34942586.
INFO Bundling directory
INFO Deploying bundle (18.10 MB)...
INFO Running script...
/app/node_modules/cylon/lib/lodash.js:33: attempt to index upvalue 'vr' (a nil v
alue)

issue with deployment and generating package.json

Running

sudo npm install -g cylon-cli
$ cylon generate tessel my-tessel-project
$ cd my-tessel-project
$ npm install
$ tessel run blink.js

the following files are generated

blink.js package.json.tpl

running `tessel run blink.js'

gets

INFO Running script...
Error: Could not find module "/node_modules/cylon/index.js"
stack traceback:
/app/blink.js:8: in function 'res'
/_start.js:4: in function 'res'
[T]: src/colony/lua/cli.lua:34: in function <[T]: src/colony/lua/cli.lua:33>

Any fixes?

Issue with generating tessel project command.

Hi, I'm testing Cylon with tessel, but I can't generate the project:
cylon generate tessel my-tessel-project

Creating new Tessel-ready robot in ./my-tessel-project

usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory

{ [Error: Command failed: usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
] killed: false, code: 64, signal: null }

My OS versión is: Mac OSX 10.9.4

node & npm ls

MacBook-Pro-de-Julio:tessel jcrodriguez$ node -v
v0.10.26

MacBook-Pro-de-Julio:tessel jcrodriguez$ npm ls
/Users/jcrodriguez/Documents/JuraseC/NodeBots México/tessel
├─┬ cylon@0.18.0
 ├── async@0.7.0
 ├─┬ body-parser@1.3.0
  ├── bytes@1.0.0
  ├── qs@0.6.6
  ├── raw-body@1.1.6
  └─┬ type-is@1.2.0
    └── mime@1.2.11
 ├─┬ express@4.4.1
  ├─┬ accepts@1.0.2
   ├── mime@1.2.11
   └── negotiator@0.4.5
  ├── buffer-crc32@0.2.1
  ├── cookie@0.1.2
  ├── cookie-signature@1.0.3
  ├── debug@0.8.1
  ├── escape-html@1.0.1
  ├── fresh@0.2.2
  ├── merge-descriptors@0.0.2
  ├── methods@1.0.1
  ├── parseurl@1.0.1
  ├── path-to-regexp@0.1.2
  ├─┬ proxy-addr@1.0.0
   └── ipaddr.js@0.1.2
  ├── qs@0.6.6
  ├── range-parser@1.0.0
  ├─┬ send@0.4.1
   ├── finished@1.1.4
   └── mime@1.2.11
  ├── serve-static@1.2.1
  ├─┬ type-is@1.2.0
   └── mime@1.2.11
  └── utils-merge@1.0.0
 └── robeaux@0.2.0
├─┬ cylon-firmata@0.15.0
 ├─┬ cylon@0.18.0
  ├── async@0.7.0
  ├─┬ body-parser@1.3.0
   ├── bytes@1.0.0
   ├── qs@0.6.6
   ├── raw-body@1.1.6
   └─┬ type-is@1.2.0
     └── mime@1.2.11
  ├─┬ express@4.4.1
   ├─┬ accepts@1.0.2
    ├── mime@1.2.11
    └── negotiator@0.4.5
   ├── buffer-crc32@0.2.1
   ├── cookie@0.1.2
   ├── cookie-signature@1.0.3
   ├── debug@0.8.1
   ├── escape-html@1.0.1
   ├── fresh@0.2.2
   ├── merge-descriptors@0.0.2
   ├── methods@1.0.1
   ├── parseurl@1.0.1
   ├── path-to-regexp@0.1.2
   ├─┬ proxy-addr@1.0.0
    └── ipaddr.js@0.1.2
   ├── qs@0.6.6
   ├── range-parser@1.0.0
   ├─┬ send@0.4.1
    ├── finished@1.1.4
    └── mime@1.2.11
   ├── serve-static@1.2.1
   ├─┬ type-is@1.2.0
    └── mime@1.2.11
   └── utils-merge@1.0.0
  └── robeaux@0.2.0
 ├── cylon-gpio@0.18.0
 ├── cylon-i2c@0.14.0
 └─┬ firmata@0.3.3
   ├── browser-serialport@1.0.6
   └─┬ serialport@1.4.6
     ├── async@0.9.0
     ├── bindings@1.2.1
     ├── nan@1.3.0
     ├─┬ node-pre-gyp@0.5.19
      ├─┬ mkdirp@0.5.0
       └── minimist@0.0.8
      ├─┬ nopt@2.2.1
       └── abbrev@1.0.5
      ├─┬ npmlog@0.0.6
       └── ansi@0.2.1
      ├─┬ rc@0.4.0
       ├── deep-extend@0.2.10
       ├── ini@1.1.0
       ├── minimist@0.0.10
       └── strip-json-comments@0.1.3
      ├─┬ request@2.36.0
       ├── aws-sign2@0.5.0
       ├── forever-agent@0.5.2
       ├─┬ form-data@0.1.2
        ├── async@0.2.10
        └─┬ combined-stream@0.0.4
          └── delayed-stream@0.0.5
       ├─┬ hawk@1.0.0
        ├── boom@0.4.2
        ├── cryptiles@0.2.2
        ├── hoek@0.9.1
        └── sntp@0.2.4
       ├─┬ http-signature@0.10.0
        ├── asn1@0.1.11
        ├── assert-plus@0.1.2
        └── ctype@0.5.2
       ├── json-stringify-safe@5.0.0
       ├── mime@1.2.11
       ├── node-uuid@1.4.1
       ├── oauth-sign@0.3.0
       ├── qs@0.6.6
       ├─┬ tough-cookie@0.12.1
        └── punycode@1.2.4
       └── tunnel-agent@0.4.0
      ├── rimraf@2.2.8
      ├── semver@2.3.0
      ├─┬ tar@0.1.19
       ├── block-stream@0.0.7
       ├─┬ fstream@0.1.25
        ├── graceful-fs@2.0.3
        └── mkdirp@0.3.5
       └── inherits@2.0.1
      └─┬ tar-pack@2.0.0
        ├── debug@0.7.4
        ├─┬ fstream@0.1.25
         ├── graceful-fs@2.0.3
         ├── inherits@2.0.1
         └── mkdirp@0.3.5
        ├─┬ fstream-ignore@0.0.7
         ├── inherits@2.0.1
         └─┬ minimatch@0.2.14
           ├── lru-cache@2.5.0
           └── sigmund@1.0.0
        ├── graceful-fs@1.2.3
        ├── once@1.1.1
        ├─┬ readable-stream@1.0.27-1
         ├── core-util-is@1.0.1
         ├── inherits@2.0.1
         ├── isarray@0.0.1
         └── string_decoder@0.10.25-1
        └── uid-number@0.0.3
     ├─┬ optimist@0.6.1
      ├── minimist@0.0.10
      └── wordwrap@0.0.2
     └── sf@0.1.7
├── cylon-gpio@0.18.0
└── cylon-i2c@0.15.0

MacBook-Pro-de-Julio:tessel jcrodriguez$ cylon -v  <====== I dunno why the cylon version is 0.9.1 here, and up says cylon@0.18.0 ======
0.9.1

MacBook-Pro-de-Julio:tessel jcrodriguez$ cylon generate tessel my-tessel-project
Creating new Tessel-ready robot in ./my-tessel-project

usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory

{ [Error: Command failed: usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
] killed: false, code: 64, signal: null }

Can you help me, please?

Thanks!

Tessel 2 support?

Tessel 2 doesn't appear to work. Looks like it's at least in part due to tessel/t2-cli#653

 cylon-example-tessel git:(master) t2 run script.js
INFO Looking for your Tessel...
INFO Connected to Tessel-x.
INFO Building project.
WARN Pre-compiled module is missing: usb.
This might be caused by any of the following:

1. The binary is platform specific and cannot be compiled for OpenWRT.
2. A pre-compiled binary has not yet been generated for this module.
3. The binary didn't compile correctly for the platform that you're developing on.
    It's possible that the binary is Linux-only or even OpenWRT specific,
    try npm installing with "--force" and rerun your deployment command.

Please file an issue at https://github.com/tessel/t2-cli/issues/new
INFO Writing project to RAM on Tessel-x (68.096 kB)...
INFO Deployed.
INFO Running script.js...
module.js:339
    throw err;
    ^

Error: Cannot find module './lib/config'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at r (/tmp/remote-script/node_modules/cylon/index.js:1:97)
    at Object.<anonymous> (/tmp/remote-script/node_modules/cylon/index.js:1:127)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.