Author Topic: Multiple servo positions with one click crash  (Read 549 times)

rusnak

  • Newbie
  • *
  • Posts: 10
Multiple servo positions with one click crash
« on: August 08, 2010, 06:12:44 PM »
I have a servo that I need to spin left and then back after a half second. I have it working just fine. However, it may only work for 1 click... or 4 clicks... Then it will usually just spin left and not come back. Once that happens, all the widgets on the dashboard will not function. I have to unplug the box, plug it back in, return the servo to the start position and then try the function again. I am using firefox, but the same problem happens in safari. Here is my code (the X's are the widget ID numbers):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title></title>

<script language="javascript">
<!--

function ServoRoutine1(){

   // assuming the servo is already at position A

   widgetExecute('XXXXXXXXX');    //  position B

   setTimeout(ServoRoutine2,500);

}



function ServoRoutine2(){

   widgetExecute('XXXXXXXXX');    //  position A

}

//-->
</script>

</head>

<body>

<a onClick="ServoRoutine1()">Servo Routine</a>

<div id="ioWidgets" style="display:none;">

<script type="text/javascript">document.write(unescape("%3Cscript src='" + "http://www.iobridge.com/widgets/io.js?XXXXXXXX' type='text/javascript'%3E%3C/script%3E"));</script>
<script type="text/javascript">document.write(unescape("%3Cscript src='" + "http://www.iobridge.com/widgets/io.js?XXXXXXXX' type='text/javascript'%3E%3C/script%3E"));</script>

</div>

</body>

</html>


iobridge

  • Administrator
  • Hero Member
  • *****
  • Posts: 669
    • ioBridge Support
Re: Multiple servo positions with one click crash
« Reply #1 on: August 10, 2010, 01:56:58 PM »
Your script looks correct.

The
Code: [Select]
setTimeout(ServoRoutine2,500); section of the code will run a half second after ServoRoutine1 is executed. If the servo is not in place, it will revert to the ServoRoutine2 position.


ioBridge Support
Community Team

rusnak

  • Newbie
  • *
  • Posts: 10
Re: Multiple servo positions with one click crash
« Reply #2 on: August 10, 2010, 08:11:03 PM »
I really appreciate the response, but I don't think that really addressed the issue. I don't think I did a very good job explaining.

ServoRoutine2 is supposed to run a half second after ServoRoutine1 in order to return the servo to the starting position. Why would the servo not be in place? Also, why would all of my other widgets stop working on the dashboard until I unplug and plug the box back in?

Since my last post, I also tested the site on Chrome and Opera. Same issue. It doesn't always get stuck in the down position, but inevitably it stops working and all of my widgets crash.

It seems like another user is having a very similar issue and neither of us have been able to identify the problem.

http://www.iobridge.net/forum/index.php/topic,652.0.html

To all iobridge users... please help. This is greatly inhibiting my progress. Thanks so much for all of the support.

iobridge

  • Administrator
  • Hero Member
  • *****
  • Posts: 669
    • ioBridge Support
Re: Multiple servo positions with one click crash
« Reply #3 on: August 10, 2010, 09:02:09 PM »
What are the positions of the two servo widgets? I will try to recreate the issue.

ioBridge Support
Community Team

rusnak

  • Newbie
  • *
  • Posts: 10
Re: Multiple servo positions with one click crash
« Reply #4 on: August 10, 2010, 09:39:17 PM »
Position 1: 1600

Position 2: 750


iobridge

  • Administrator
  • Hero Member
  • *****
  • Posts: 669
    • ioBridge Support
Re: Multiple servo positions with one click crash
« Reply #5 on: August 11, 2010, 09:19:41 AM »
I have simulated your scenario. I have a Servo on Channel 1 of the Servo Smart Board. I am using the 1 AMP power supply. I created two fixed widgets one for 1600 and 750.

Everything worked perfectly. I click the servo moves to one position and then the other. It even works when I double click it (if by accident).

Here is the code:

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title></title>

<script language="javascript">
<!--

function ServoRoutine1(){

   // assuming the servo is already at position A

   widgetExecute('s314MCLQCKlN');    //  position B

   setTimeout(ServoRoutine2,500);

}



function ServoRoutine2(){

   widgetExecute('wuKjBQt05bi9');    //  position A

}

//-->
</script>

</head>

<body>

<a onClick="ServoRoutine1()">Servo Routine</a>

<div id="ioWidgets" style="display:none;">

<script type="text/javascript">document.write(unescape("%3Cscript src='" + "http://www.iobridge.com/widgets/io.js?wuKjBQt05bi9' type='text/javascript'%3E%3C/script%3E"));</script>
<script type="text/javascript">document.write(unescape("%3Cscript src='" + "http://www.iobridge.com/widgets/io.js?s314MCLQCKlN' type='text/javascript'%3E%3C/script%3E"));</script>

</div>

</body>

</html>

Did you put the widgetID in the hidden section (display:none div)?

If you are still have an issue, drop us a line at support@iobridge.com with your serial number. We will take a closer look.
ioBridge Support
Community Team