Latching Logic and Syntax
new arduino , having heck of time making transition programming plcs using ladder logic. i'd recommendation how approach programming following setup.
* 3 lights, each attached relay output (l1=off, l2=on, l3=complete)
* 2x digital inputs...1 cycle status (on/off) , 1 door status (open/closed).
i able monitor cycle status input activate lights 1 & 2, need have light 3 come on after completed cycle turn off/reset when door opened. closing door should not turn light 3 on again. on right track here or there easier way this? doing logic in ladder use latch fire light 3 when complete , release when door opened. after door closed again, light 3 not turn on again until cycle has completed.
here's current code in loop
* 3 lights, each attached relay output (l1=off, l2=on, l3=complete)
* 2x digital inputs...1 cycle status (on/off) , 1 door status (open/closed).
i able monitor cycle status input activate lights 1 & 2, need have light 3 come on after completed cycle turn off/reset when door opened. closing door should not turn light 3 on again. on right track here or there easier way this? doing logic in ladder use latch fire light 3 when complete , release when door opened. after door closed again, light 3 not turn on again until cycle has completed.
here's current code in loop
code: [select]
// read digital pin d35 = cycle in progress. l2 on during cycle.
int cycleon = digitalread(35);
// set relay6 state according d35 "actual: on=on, off=off"
digitalwrite(plduino::relay6, cycleon);
// read digital pin dxx = cycle completed. l3 on after cycle until door switch opened.
// set relay5 state according d35 change while d30 stays same
int doorclosed = digitalread(30);
digitalwrite(plduino::relay5, doorclosed);
// read digital pin d35 = cycle in progress. l1 off during cycle.
int cycleoff = !cycleon;
// set relay4 state according d35 "opposite: on=off, off=on"
digitalwrite (plduino::relay4, cycleoff);
quote
here's current code in loopgiven posted of code, i'll assume looking of answer.
so, need is...
well, that's of answer. hope helps.
i don't understand why need int store value, temporarily of not cycleon. can use !cycleon in call digitalwrite().
Arduino Forum > Using Arduino > Project Guidance > Latching Logic and Syntax
arduino
Comments
Post a Comment