From e3bec28f35ae2f1d2f251eb8170e039c27d6c9e1 Mon Sep 17 00:00:00 2001 From: raluca-elena Date: Mon, 1 Sep 2014 07:25:22 +0000 Subject: [PATCH] eva partially makes a step --- slave/deviceServers/evaServer.js | 49 ++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/slave/deviceServers/evaServer.js b/slave/deviceServers/evaServer.js index 46fce42..44b1fb7 100644 --- a/slave/deviceServers/evaServer.js +++ b/slave/deviceServers/evaServer.js @@ -1,33 +1,40 @@ +var arg = process.argv; +var x = arg.shift(); +x = arg.shift(); +console.log("dskhskjhfkjsdhfkjdshgk ", arg); var fs = require('fs'); var ev3 = require('ev3dev'); -//Create the motor on port A +//var ev32 = require('ev3'); +//var voltage = ev32.battery.getVoltage(); +//console.log("voltage is ", voltage); var motorA = new ev3.Motor(ev3.MotorPort.A); var head = new ev3.Motor(ev3.MotorPort.C); -//Run the motor at 60% power for five seconds, and then hold it in place - -//var tachoCountA = ev3.Motor.getTachoCount('A'); -//console.log("tachoCount is ---- ", tachoCountA); -motorA.startMotor({ - targetSpeed: -50, - time: 5000, - stopMode: 'hold' -}); -//var speedA = ev3.Motor.getSpeed('A'); -//console.log("----speed A is", speedA); - -//var tachoCountC = ev3.Motor.getTachoCount('C'); -//console.log("tachoCount is ---- ", tachoCountC); head.startMotor({ - targetSpeed: 50, - time: 5000, - stopMode: 'hold' + targetSpeed: arg[0], + time: 4000, +//stopMode: 'hold' }); +console.log("----started head---"); -//var speedB = ev3.Motor.targetSpeed(C); -//console.log("----speed A is", speedC); +setTimeout(function() { + console.log("--started leg--"); + motorA.startMotor({ + targetSpeed: arg[1], + time: 4000, +//stopMode: 'hold' + }); + }, 9000); +setTimeout(function() { + console.log("--started leg--"); + motorA.startMotor({ + targetSpeed: -arg[1], + time: 4000, +//stopMode: 'hold' + }); + }, 18000); //open file /sys/class/msensor/sensor1/value0 -- touch sensor var file =fs.readFileSync("/sys/class/msensor/sensor0/value0"); -console.log("file is--- ", JSON.parse(file)); \ No newline at end of file +console.log("file is--- ", JSON.parse(file));