Author Topic: Servo control.  (Read 671 times)

Tyler

  • Newbie
  • *
  • Posts: 22
Servo control.
« on: November 22, 2009, 10:53:55 PM »
Could you make a action were a servo will go to a position and then come back?

Example, the servo starts at 1500 goes to 2000 for 1 second, then goes back to 1500. I know this can be done in java script but i'm just wondering if you could make a widget or action to do that. 

Thanks
Tyler

zero*gx

  • Full Member
  • ***
  • Posts: 116
    • zero*gx
Re: Servo control.
« Reply #1 on: November 22, 2009, 11:44:37 PM »
these was some code to do that on the forum
zero*gx | imagineering solutions

iobridge

  • Administrator
  • Hero Member
  • *****
  • Posts: 669
    • ioBridge Support
Re: Servo control.
« Reply #2 on: November 23, 2009, 12:53:14 AM »
You could do this with on-board actions or JavaScript.

Here's how if you want to use the on-board actions and a widget:

Create a positive pulse out widget that sets the state of the output for 1000ms
Connect the Digital Output to a Digital Input using a wire
Create a standard on-board action
Add some conditions
      Variable A is not equal to 1
      Digital Input is On
Add some actions
      Set servo to position 1500
      Set Variable A to 1
Create a second standard action
Add some conditions
      Variable A is not equal to 2
      Digital Input is Off
Add some actions
      Set servo to position 2000
      Set Variable A to 2

That should do it. The trick is connecting a digital output to an input with a wire.

Good luck, let us know if that works for you.
« Last Edit: November 23, 2009, 01:11:34 AM by iobridge »
ioBridge Support
Community Team

Tyler

  • Newbie
  • *
  • Posts: 22
Re: Servo control.
« Reply #3 on: November 23, 2009, 04:56:13 PM »
Ok thanks :D Ill try it out and tell you how it goes.