inputs:
Pedestrian push button A (to cross NS)
Pedestrian push button B (to cross EW)
Pedestrian push button C (to cross NS)
Pedestrian push button D (to cross EW)
Traffic sensor 1 (to cross NS)
Traffic sensor 2 (to cross EW)
Traffic sensor 3 (to cross NS)
Traffic sensor 4 (to cross EW)
Reset.
Those 9 physical inputs are used only for 2 different actions, so we can group them in 2 inputs, cross NS or cross EW. The other is to reset the circuit.
So:
A, C, 1, 3 - Cross NS
B, D, 2, 4 - Cross EW
Reset
The Outputs, would be 20 different lights, but grouped as I did with the inputs, would be.
NS Green
NS Yellow
NS Red
EW Green
EW Yellow
EW Red
NS Ped. Green
NS Ped. Red
EW Ped. Green
EW Ped. Red
Now, in my code, i have doubled the outputs, which i didn't do the first time i wrote the code. I still have to check and correct the addresses (i0.1...q0.4..), but i don't have them yet.
The only thing that is left I think is to change the code to let those 2 inputs change the state.
I've thought that instead of the first SFC i drew, where pushing the button/sensor changed the state from red to green immediately (and besides, green to red in the other direction), it should change the active direction a few seconds to yellow before it gets red. Do you think that this would be far too complicate?? If it was, we'd stick to the first idea, radical change to green, haha. I will draw the new SFC tomorrow 'cause now is a bit late.
By the way
Lancie1, i don't know which networks should I change with the code you wrote for me :$ I try to understand what it does but... baby steps. You mean that i would only need to change that net7 in order to work as i want? You are achieving Heaven with me, hahaha, thank you very much, really.
Thanks!!