Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var outputsArray = [out0, out1, out2, out3, out4, out5, out6, out7];
- global.declareBoolean("firstTrigger", false);
- global.declareBoolean("isFirstTriggered", false);
- function firstPhase() {
- var firstTriggerState = firstTrigger.get();
- outputsArray.forEach(out => {
- out.setHighVoltage(in0.getVoltage());
- out.setLowVoltage(in1.getVoltage());
- out.setState(false);
- });
- if (in2.getVoltage() == 0) isFirstTriggered.set(false);
- if (in2.getVoltage() <= in1.getVoltage()) {
- if (firstTriggerState == true) {
- firstTrigger.set(false);
- isFirstTriggered.set(true);
- }
- if (firstTriggerState == false) {
- firstTrigger.set(true);
- isFirstTriggered.set(true);
- }
- }
- if (firstTrigger.get() == true) {
- if (in2.getVoltage() <= in3.getVoltage()) {
- out0.setState(false);
- out3.setState(false);
- } else if (in2.getVoltage() > in3.getVoltage()) {
- out0.setState(true);
- out3.setState(true);
- }
- } else if (firstTrigger.get() == false) {
- if (in2.getVoltage() <= in3.getVoltage()) {
- out1.setState(false);
- out2.setState(false);
- } else if (in2.getVoltage() > in3.getVoltage()) {
- out1.setState(true);
- out2.setState(true);
- }
- }
- }
- firstPhase();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement