Author Topic: digital button to initiate action  (Read 781 times)

Oohay

  • Newbie
  • *
  • Posts: 1
digital button to initiate action
« on: December 16, 2009, 09:16:43 PM »
 Is it possible to create a digital "button" or "switch to set off a condition?  Specifically, I was wondering if it would be possible to create a digital condition that when activated from the web, allows for a series of servo movements to be run in a specific sequence as the action.

iobridge

  • Administrator
  • Hero Member
  • *****
  • Posts: 668
    • ioBridge Support
Re: digital button to initiate action
« Reply #1 on: December 17, 2009, 01:42:36 AM »
You have a few ways to trigger an action from the web. You can use the state of the digital output to trigger an action. You can also use the pulse count to trigger an action. We have widgets to control the digital output state and widgets to set the pulse count on a channel.

The onboard actions "allow" you to create a time-based sequence. I attached a screenshot of my rules, so you can see how I accomplished it. This is sort of complicated since the rules we have were not sequence based they are more cause/effect based. But this "hack" makes it possible.

I have a widget that sets the digital output state on channel 1. I have a servo board on channel 4.

Currently, the pulse output is the only time-based output. We are going to use that on Channel 2 and bounce from low to high and low (etc.) and each transition can have a set amount of time and we can base rules off of those transitions.

There are also variables on the module you can set. I am going to use those to make sure one action executes at a time. I will also use them to keep track of the step the sequence is on.

Now, looking at the screen shot, I will try to explain:

1) and 2) The conditions are reading the state of channel 1's digital output. This output is controlled by a widget that I can embed anywhere. When it goes high (1), it starts the sequence and low (0), the sequence stops.

3) This is the first state of the servo. I move it to 1000 to start (soon as variable A becomes 100 - which was set in rule 1). Then, I set the Var A to 101 getting it ready for the next step in the sequence. I set the pulse width of channel 2 to however long that time I want between steps. It's important to note that it's a "Negative State Pulse" - this pulse type starts low and ends high after the time finishes.

4) When the output on channel two goes high, it executes the next step. in this example, I move the servo to 1900. As you see, I set Var A to 102 (which is the next step) and set the pulse out timer to 5000ms. Note that in this case it's a positive pulse - this type of pulse will start high and end low after the time has elapsed.

5) This is the final step in my example. When channel two's pin finally goes low, it moves the servo to 1500.

If you wanted to keep going, you would add a negative pulse on channel two for however long you want and base the next rule on that state. The next rule would be positive, and so forth.

Give it a try. Let us know how it works for you.
ioBridge Support
Community Team