Trying to run a motor one direction, wait 5 seconds and run back the other way. 1065 PhidgetMotorControl 1-motor
I just can't figure it out.
Can someone please help?
Marsha
Code: Select all
var phidget22 = require('phidget22');
function runExample() {
var dcMotor0 = new phidget22.DCMotor();
dcMotor0.open(5000).then(function() {
dcMotor0.setTargetVelocity(1);
setTimeout(function () {
dcMotor0.close();
process.exit(0);
}, 5000);
});
dcMotor0.open(5000).then(function() {
dcMotor0.setTargetVelocity(-1);
setTimeout(function () {
dcMotor0.close();
process.exit(0);
}, 5000);
});
}
var conn = new phidget22.Connection(5661, 'localhost');
conn.connect().then(runExample);