-
Notifications
You must be signed in to change notification settings - Fork 362
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
cylonjs not working when i use motor shield for Arduino #222
Comments
Could you provide cylon and cylon-firmata version numbers and what OS are you using? It will also help to know what code are you running and how you have it wired... |
Also which motor shield, please. |
@solojavier npm ERR! System Darwin 12.5.0 and the code is as belowvar Cylon = require('cylon'); Cylon.robot({ devices: [{ name: 'leapmotion', driver: 'leapmotion', connection: 'leapmotion' }, work: function(my) { if(pitchRadians > 0.2){ } else { } if(pitchRadians < -0.2){ } else { } if(rollRadians > 0.3){ } else { }if(rollRadians < -0.3) { } else { if( pitchRadians > 0.1){ if (pitchRadians < -0.1 ) { if(rollRadians > 0.3){ } else { } if(rollRadians < -0.3) { } else { i am using DK Electronics Arduino motor shield |
Seems like you need to update cylon to 0.16, please do:
|
@solojavier |
run: |
@solojavier for npm list cylon-firmata |
So the error should be gone now, can we close this issue? |
@neonag your dependency tree appears to be a little bit messed up due to the new release, can you reinstall everything with:
And then let us know what the result of |
this is the error i get after i did the install as you said ── cylon@0.17.0 npm ERR! peer invalid: cylon-gpio@0.15.1 /Users/neo/node_modules/cylon-gpio |
Hmm, that's really weird. Can I get the output of just Sorry for the inconvenience, think it's a dependency issue to do with cylon-firmata. |
no problem there is no inconvenience i need to reach my goal of making cylonJS work with firmata if i succeed in overall my project i can brag and introduce cylonJS usage in my university ├─┬ cylon@0.17.0 npm ERR! peer invalid: cylon-gpio@0.15.1 /Users/neo/node_modules/cylon-gpio |
Do you have a |
i did manual install |
not everything but few of them .. but don't remember which |
Can you try forcing your cylon modules to update with this command? Then run
|
yup did it and got this ├── cylon@0.17.0 |
Okay, awesome. Looks like you have the latest versions of everything now. Can you check if the issue is still present? |
surely i will test my code on the Motor Shield and get back in some time |
still not working :( the motor sheild doesnt respond i tried a simple code to run a servo motor now so that its easy for testing using the following code : var Cylon = require('cylon');
Cylon.robot({
connection: [
{ name: 'arduino', adaptor: 'firmata', port: '/dev/tty.usbmodem621'},
{ name: 'leapmotion', adaptor: 'leapmotion', port: '127.0.0.1:6437' }
],
device: [
{name: 'servo', driver: 'servo', pin: 3},
],
work: function(my) {
var angle = 45 ;
var angle1 = 135;
my.servo.angle(angle);
my.leapmotion.on('hand', function(hand) {
if(hand.grabStrength == 1){
my.servo.angle(angle);
} else if(hand.grabStrength == 0) {
my.servo.angle(angle1);
}
});
}
}).start(); |
@neonag I don't think that's how the motor shield works, the first motor shield the v1 used the pwm pins of the arduino the v2 uses an i2c pwm driver in the shield if I remember correctly. Try just connecting the servo to the arduino directly, with the same code, and connect the DC plug on the arduino to provide enough juice. If that works fine, then it is an issue on how to wire up the motor shield. @deadprogram might be able to provide some assistance with that, he has some experience with the motor shield, and I only have the I2C one. |
@edgarsilva |
Hi, there. This is my code I use for the v1 motor shield, controlled by a Spark: var Cylon = require('cylon');
Cylon.robot({
connection: {
name: 'spark', adaptor: 'spark',
accessToken: '[your access token]',
deviceId: '[your device id]'
},
devices: [
{name: 'leftMotor', driver: 'motor', pin: "D1"},
{name: 'rightMotor', driver: 'motor', pin: "A7"},
{name: 'leftDirection', driver: 'direct-pin', pin: "D3"},
{name: 'rightDirection', driver: 'direct-pin', pin: "D4"}
],
work: function(my) {
my.leftDirection.digitalWrite(1);
my.rightDirection.digitalWrite(1);
my.leftMotor.speed(100);
my.rightMotor.speed(100);
after((10).seconds(), function() {
my.leftDirection.digitalWrite(0);
my.rightDirection.digitalWrite(0);
});
after((20).seconds(), function() {
my.leftDirection.digitalWrite(1);
my.rightDirection.digitalWrite(0);
});
after((21).seconds(), function() {
my.leftDirection.digitalWrite(0);
my.rightDirection.digitalWrite(1);
});
after((22).seconds(), function() {
my.leftDirection.digitalWrite(1);
my.rightDirection.digitalWrite(0);
});
after((23).seconds(), function() {
my.leftDirection.digitalWrite(0);
my.rightDirection.digitalWrite(1);
});
after((24).seconds(), function() {
my.leftMotor.turnOff();
my.rightMotor.turnOff();
});
}
}).start(); The v1 motor shield uses 2 pins per motor that it can control. One PWM for speed, the other for direction. Hope that helps! |
@deadprogram |
hi all you can close the post now i guess the problem with the board itself need to get new sheild and try again |
How do I add multiple led's in arduino and write the code // define the robot devices: { work: function(my) { // connect to the Arduino and start working |
i had a code running in cylonjs on a bread board with 2 l293d connected to arduino but when i tried using the motor shield nothing seems to work .. need help on this !!
The text was updated successfully, but these errors were encountered: