This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

oscillator function in FB editor not working
#1
The purpose is to activate and deactivate a contactor every x seconds.

This simple script made in FBeditor does not work
The objects are virtual objects, not used in other functions.  No errors in the logs.


Scripts added
FB Event for 32/1/30
require('custom.fbeditor20.Control')

Pulse_width = 1
Cycle = 70
Enable = event.getvalue()
out, out_not, state = fbe_oscillator(Pulse_width, Cycle, Enable, 'fb__New_diagram__fbe_oscillator__id')
if out ~= nil then
grp.write('32/1/31', out)
end
Reply
#2
Probably the block source must be a timer not an event.

You can use a simple resident script (0 sleep time) instead:
Code:
out = '1/1/2'
enable = grp.getvalue('1/1/1')

grp.checkwrite(out, enable)
os.sleep(7)

grp.checkwrite(out, false)
os.sleep(3)
If 1/1/1 is ON then 1/1/2 is ON for 7 seconds, then off for 3 seconds. If 1/1/1 is OFF then 1/1/2 is always OFF.
Reply


Forum Jump: