Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

servo example not working #21

Open
hiattp opened this issue May 16, 2012 · 10 comments · May be fixed by #40
Open

servo example not working #21

hiattp opened this issue May 16, 2012 · 10 comments · May be fixed by #40

Comments

@hiattp
Copy link

hiattp commented May 16, 2012

Love this framework. led.blink() works fine, but I can't get my servo to respond. The servo sweep example that comes with the arduino software works well so I don't think its the servo. Here is what I'm seeing in the log:

1337133106943 duino info attempting to find Arduino board
1337133106947 duino info set pin 13 mode to out
1337133106947 duino info serial not ready, buffering message: 0013001
Express server listening on port 3000 in development mode
1337133106957 duino info found board at /dev/tty.usbmodem411
1337133106957 duino info binding serial events
1337133107459 duino info board ready
1337133107459 duino info sending debug mode toggle on to board
1337133107465 duino write 9900001
1337133107467 duino info processing buffered messages
1337133107467 duino info writing buffered message
1337133107467 duino write 0013001
board ready, attaching servo { board:
{ debug: true,
writeBuffer: [],
_events: { ready: [Function], data: [Function] },
serial:
{ port: '/dev/tty.usbmodem411',
fd: 7,
readStream: [Object],
_events: [Object] } },
pin: '09',
_events: { attached: [Function] } }
1337133107469 duino write 980901


And then it stops. Thoughts? This is my code (pretty much straight from your example):

var arduino = require('duino'),
board = new arduino.Board({debug:true});

var led = new arduino.Led({
board: board,
pin: 13
});

var servo = new arduino.Servo({
board: board,
pin: 9
});

servo.on('attached', function(err) {
console.log('attached');

this.on('read', function(err, pos) {
console.log(pos);
});

this.on('detached', function(err) {
console.log('detached');
});

this.on('aftersweep', function(err) {
led.blink();

this.read();
this.detach();

});

this.sweep();
});

@ptit
Copy link

ptit commented Aug 31, 2012

Been a while, but this should fix it:

board.on('ready', function(){
servo.sweep()
});

@Nikolaibibo
Copy link

First of all: really great work :)

Any news on this?
Seems as if the example is still not working.

i tried it with the default port and additionally with a defined port.
my code:

var board = new arduino.Board({
debug: true
});

var led = new arduino.Led({
board: board,
pin: 13
});

var servo = new arduino.Servo({
board: board,
pin: 10
});

board.on('ready', function(){
console.log("onBoardReady");
servo.sweep()
});

And the console log

1348077083718 duino info attempting to find Arduino board
Server has started.
1348077083735 duino info found board at undefined
1348077083735 duino info binding serial events
1348077084237 duino info board ready
1348077084238 duino info sending debug mode toggle on to board
1348077084238 duino write 9900001
board ready, attaching servo { board:
{ debug: true,
writeBuffer: [],
_events: { ready: [Object], data: [Function] },
serial: { _events: [Object], fd: 9, readStream: [Object] } },
pin: '10' }
1348077084240 duino write 981001
onBoardReady
1348077084241 duino write 981003
1348077086243 duino write 981003
1348077086246 duino receive signal: servo
1348077086250 duino receive reading servo
1348077086250 duino receive 10::read::093
1348077086250 duino info moving to: 180
1348077086251 duino write 981002180
1348077086254 duino receive signal: servo
1348077086258 duino receive writing to servo
1348077086258 duino receive 180
1348077088244 duino write 981003
1348077088249 duino receive signal: servo
1348077088249 duino receive reading servo
1348077088253 duino receive 10::read::180
1348077088253 duino info moving to: 180
1348077088253 duino write 981002180
1348077088257 duino receive signal: servo
1348077088261 duino receive writing to servo
1348077088261 duino receive 180

Any ideas?
Even the examples within the repo does not work - it stops with the same issue that hiattp had.
Cheers
Nikolai

@ecto
Copy link
Owner

ecto commented Sep 19, 2012

@Nikolaibibo

Looks like this could be your problem?

1348077083735 duino info found board at undefined

It appears it's not finding a board, but the program continues.

If this isn't the problem, I'm not sure. I've been super busy with work lately, and haven't been able to maintain this repo like I had hoped. I'll wire up a servo this weekend and take a deeper look for you guys :)

@Nikolaibibo
Copy link

Hey ecto ;)

thx for the quick respond!
it seems as if i've been blind :D

Thanks for your hint - i really appreciate!
Looking forward to your servo tests :)

@Nikolaibibo
Copy link

Just to make it clear:

i added a few logs to the board.js to trace the "undefined":

1348149217505 duino usb:: tty.usbmodemfa141 (self.log("usb:: " + possible);)
1348149217505 duino possible: tty.usbmodemfa141 (self.log("possible: " + possible);)
1348149217506 duino possible -> tmp.port: undefined (self.log("possible -> tmp.port: " + temp.port);)

maybe this helps you a bit.
i'm a bit to new to arduino to see where it gets stuck...

thanks in advance :)

Nikolai

@ecto
Copy link
Owner

ecto commented Sep 24, 2012

Hey, couldn't find anything anomalous. Could you post the circuit you're using?

@Nikolaibibo
Copy link

Hey ecto :)
thx for your reply, i really appreciate!

i used a circuit like this:
http://arduino.cc/en/uploads/Tutorial/sweep_BB.png

i tried out a few digital ports like 9, 10 or 11.
my arduino is connected to "/dev/tty.usbmodemfa141"

i also tried the johnny-five solution on git (https://github.com/rwldrn/johnny-five/) and this works fine with this circuit.
Cheers

Nikolai

@mckapur
Copy link

mckapur commented Nov 22, 2013

I'm getting the same error....

@grumpyoldman-io
Copy link

Hey peeps,
was anyone able to solve this? I get the exact same "board ready, attaching servo" message.
cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@Nikolaibibo @ecto @hiattp @ptit @mckapur @grumpyoldman-io and others