0

Using this exact code for my nodeJS file on my Intel Edison referenced from http://cylonjs.com/documentation/drivers/maxbotix/

The only difference is in the line edison: { adaptor: 'intel-iot' }

var Cylon = require('cylon');
Cylon.robot({
  connections: {
    edison: { adaptor: 'intel-iot' }
  },

  devices: {
    maxbotix: { driver: 'maxbotix' }
  },

  work: function(my) {
    every((1).seconds(), function() {
      my.maxbotix.range(function(data) {
        console.log("range: " + data);
      });
    });
  }
}).start();

I've done a npm install so all my modules are installed and doublechecked my wiring to ensure my sensor is connected properly.

Whenever I run the app I get the error

Error: No pin specified for Maxbotix. Cannot proceed

Any arduino, nodejs or cyclonjs experts able to suggest what is missing or wrong?

4

1 回答 1

0

您需要在设备定义中指定 maxbotix 连接到的模拟引脚,如下所示:

var Cylon = require('cylon');

Cylon.robot({
 connections: {
  edison: { adaptor: 'intel-iot' }
 },

 // should be one of the analog pins from 0 to  5
 // if using the arduino shield.
 devices: {
  maxbotix: { driver: 'maxbotix', pin: '1' }
 },

 work: function(my) {
  every((1).seconds(), function() {
   my.maxbotix.range(function(data) {
    console.log("range: " + data);
   });
  });
 }
}).start(); 
于 2015-02-13T20:34:34.120 回答