Logic Machine Forum
oscillator function in FB editor not working - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: oscillator function in FB editor not working (/showthread.php?tid=4984)



oscillator function in FB editor not working - KRIS DOCX - 24.09.2023

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


RE: oscillator function in FB editor not working - admin - 25.09.2023

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.