Quote: Originally Posted by
baillie11 
Hi I just got a FB V4 and have NO IDEA where to start.
I have managed to connect a small motor to it and with a click on a button (Digital Output 4) get it to turn on and Off.
That is a pretty good start!
Quote: Originally Posted by
baillie11 
BUT what if I want to say have it run for 10 seconds, then switch off for 2 seconds then say reverse direction for 10 seconds - how would I do that??
Ok there are multiple ways. The first way is what I have been telling people to do for years now and it works fine, but setup is a little more complicated than it should be.
To do this with "Solution A", you can use the Configurator for it all. First you need to create two numeric variables that default to 0 (lets say Var1 and Var2). Then you would need to create a logic block that says "if Var1 equals 1, then Var2 = Var2 + 1, else Var2 = 0". And then another logic block that says "if Var1 = 2, then Var1 = 0". Now what this does is basically increment a variable when a second variable is triggered. So To make a button trigger this, you would make a button with its vote to increment Var1 (i.e. "Var1 = Var1 + 1").
Now this button will start Var2 incrementing when pushed. Next push it will stop and reset the variables.
Now to make this influence a digital output, you should have another logical block that says "if 1 < var2 < AA, then turn on Digital Output X and turn off Digital Output Y". Another to say "if AA < var2 < BB, then turn off both outputs". And yet another to say "if BB < var2 < CC, then turn off Digital output X and turn on Digital Output Y". And if you want it to autoshutoff then another "if CC < var2, then Var1 = Var1 + ".
AA, BB, and CC are numbers that are calculated based off of the logic timer interval. If the logic timer is set to 100 (100ms), then to get the first logic statement to be true for 10 seconds (10000ms), you would set AA to 10000ms * [(1 timer tick)/(100ms)] = 100ticks = AA. Now if you want it off for 2 seconds, then 2000/100 = 20 = BB. Now you want the other output on for 10s which again is 100, which equals CC.
So between time = 1 and time = AA, Digital Output X is on and Digital Output Y is off.
Between time = AA and time = BB, both outputs are off.
Between time = BB and time = CC, Digital Output X is off, and Digital Output Y is on.
Now if this is a regular motor, then you will need some sort of H bridge. And Digital Output X will actually be tied to 2 relays, and Digital Output Y will be tied to relays like in the image below:
http://en.wikipedia.org/wiki/File:H_..._operating.svg
Phew... Ok, that is solution 1 and it can all be done in the Configurator. Solution 2 is much simpler but requires editing the FusionConfiguration.xml file directly.
Code:
<iochannel id="Digital Output X" port="0" brain="Brain1" type="digital_output">
<defaults defaultstate="off" />
<sequence period="1000" iterations="1">
<value order="0" state="on"></value>
<value order="10" state="off"></value>
<value order="12" state="on"></value>
<value order="22" state="off"></value>
</sequence>
</iochannel>
<iochannel id="Digital Output Y" port="1" brain="Brain1" type="digital_output">
<defaults defaultstate="off" />
<sequence period="1000" iterations="1">
<value order="0" state="off"></value>
<value order="10" state="off"></value>
<value order="12" state="on"></value>
<value order="22" state="off"></value>
</sequence>
</iochannel>
Now what that does is every "order * period" (which is 1000ms) it changes the state automatically to "state".
So at the time the Digital Output X is turned on (time = 0), the output is on. Then at time, time = period * order = 1000 * 10 = 10seconds, it is turned off. At time, time = 1000 * 12 = 12secs, it is turned off. At 22s, it remains off.
And at the time the Digital Output Y is turned on (time = 0), the output is off. Then at time, time = 10seconds, it is still turned off. At time, time = 12secs, it is turned on. At 22s, it is turned off.
It loops "iteration" times. You can set it to a # like 1,2,3,4,5,ect... or to "forever".
Quote: Originally Posted by
baillie11 
I can (sort off) see how the configurator works, but how do I get my functions onto the uber mdx control centre.
You just save your file to the MDX directory and open MDX.
Quote: Originally Posted by
baillie11 
Also is there any way to test my functions whilst in the configurator?
No. But you can save it to the MDX directory, and then there are various debug options to help inside of MDX. You can have variable and logic block outcome debug windows to see what is going on behind the scenes. Look in the debug options of the configurator for the options.