hybridgroup / cylon-gpio

Cylon drivers for GPIO devices
http://cylonjs.com
Other
19 stars 14 forks source link

Continous Servo's wrong documentation. #25

Closed tkelestemur closed 10 years ago

tkelestemur commented 10 years ago

In the doc of the continous servo which is in your website, there is a piece of code which is written for standard servo and it's now working with continuous servo because there is no method called 'angle' and 'servo' as far as I understand from the continuous servo lib.

I have tried to write example code for continuous servo but couldn't make it.

http://cylonjs.com/documentation/drivers/continuous-servo/

tkelestemur commented 10 years ago

I wrote an example code. it is calling continuous servos's method somehow even I called it from servo lib.

var Cylon = require('cylon');

Cylon.robot({ connection: {name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0'},

device: {name: 'servo', driver: 'continuous-servo', pin: 3},

work: function(my) {

my.servo.clockwise();

} }).start();

If I write continuous-servo instead of servo in function it is not working. I'm a bit confused because it should work with continuous-servo not servo.

stewart commented 10 years ago

This is because inside the robot's work block, the variables on my are set to the name of the device/connection. They're arbitrary. For example:

var Cylon = require('cylon');

Cylon.robot({
  connection: {name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0'},
  device: {name: 'banana', driver: 'continuous-servo', pin: 3},

  work: function(my) {
    my.banana.clockwise();
  }
}).start();

Would have the same result.

tkelestemur commented 10 years ago

Okay I understand now. The only problem left is continuous-servo doc. It will be good to change it for no further confusion.

edgarsilva commented 10 years ago

The continuous servo doc error is for the cylon-site issue, I'm closing this and moving the issue over there.