Author Topic: Javascript  (Read 759 times)

bbfreak

  • Newbie
  • *
  • Posts: 20
Javascript
« on: February 28, 2010, 03:31:48 AM »
I have a pulse variable and i'm trying to create buttons to increase and decrease the pulse variable by 100. However it cannot get higher / lower than a certain number. I made two functions that are called when the buttons are pressed however it doesn't seem to work.

Code: [Select]
function moveServoDown(widgetID){
 
 current = parseInt(widgetGetString(widgetID));
 if (current == 100) {
    max = " - MAX";
 }
 else {
      move = current + 100;
 widgetSetString(widgetID, move);
 }

   document.getElementById("ServoPosition").innerHTML = current + "°" + max;
}

function moveServoUp(widgetID){
 
 current = parseInt(widgetGetString(widgetID));
 if (current == 1100) {
    max = " - MAX";
 }
 else {
      move = current - 100;
 widgetSetString(widgetID, move);
 }

   document.getElementById("ServoPosition").innerHTML = current + "°" + max;
}

any idea what's wrong?

bbfreak

  • Newbie
  • *
  • Posts: 20
Re: Javascript
« Reply #1 on: March 02, 2010, 07:37:30 PM »
never mind I figured it out.

One more thing. Is there any way to send the module into a sleep / turn it off and on by sending it commands?

jason

  • Administrator
  • Hero Member
  • *****
  • Posts: 502
    • ioBridge.com
Re: Javascript
« Reply #2 on: March 03, 2010, 09:25:08 AM »
The IO-204 doesn't have a sleep mode.  You can't turn it on or off remotely either.  Although, it's an interesting idea, especially for those that have battery powered projects.
Jason Winters
ioBridge Developer