Hallo
I am writing here beacause i have problem with my program. I am debuging in cloud9 ide. Program is running through few seconds, they works, but later i have this error. “timers.js:103
if (!process.listeners(‘uncaughtException’).length) throw e;” . Can anyone help me.
var b = require(‘bonescript’);
var k = 63;
var f = 174.5;
var re = 130;
var rf = 119.5;
var sqrt3 = Math.sqrt(3);
var sin120 = sqrt3/2.0;
var cos120 = -0.5;
var duty_min = 0.1250;
b.pinMode(‘P9_14’, b.OUTPUT);
b.pinMode(‘P9_14’, b.OUTPUT);
b.pinMode(‘P9_14’, b.OUTPUT);
check();
function check(){
var analogone =(120*b.analogRead(‘P9_40’)-60).toFixed(2);
var analogtwo =(120*b.analogRead(‘P9_39’)-60).toFixed(2);
var analogthree =(80*b.analogRead(‘P9_38’)-180).toFixed(2);
console.log([analogone,analogtwo,analogthree]);
calcinverse(analogone,analogtwo,analogthree);
}
function updateDuty(thetaone,thetatwo,thetathree) {
var duty_cycleone = (thetaone*(-0.0006944))+duty_min;
var duty_cycletwo = (thetatwo*(-0.0006944)) + duty_min;
var duty_cyclethree = (thetathree*(-0.0006944)) + duty_min;
b.analogWrite(‘P9_14’, duty_cycleone, 60);
b.analogWrite(‘P9_21’, duty_cycletwo, 60);
b.analogWrite(‘P8_13’, duty_cyclethree, 60);
console.log([duty_cycleone,duty_cycletwo,duty_cyclethree]);
check();
}
function theta(x0,y0,z0)
{
var y1 = (-0.5) * 0.57735 * f;
var y2 = y0 - (0.5 * 0.57735 * k);
var a = (x0x0 + y2y2 + z0z0 +rfrf - rere - y1y1)/(2*z0);
var b = (y1-y2)/z0;
var d = -(a+by1)(a+by1)+rf(bbrf+rf);
if (d.value < 0)
{
return;
}
var yj = (y1 - ab - Math.sqrt(d))/(bb + 1);
var zj = a + b*yj;
var h;
if (yj>y1)
{
h=180;
}
else
{
h=0;
}
var thetaa = (180.0*Math.atan(-zj/(y1 - yj))/Math.PI)+h ;
return thetaa;
}
function calcinverse(x0, y0, z0)
{
var thetaone =theta(x0,y0,z0);
var thetatwo= theta(x0cos120 + y0sin120, y0cos120-x0sin120, z0);
var thetathree= theta(x0cos120 - y0sin120, y0cos120+x0sin120, z0);
console.log([thetaone,thetatwo,thetathree]);
updateDuty(thetaone,thetatwo,thetathree);
}
^"