traffic lights on arduino atmega 256

Hello dear friends, i have a quenstion for you, about my project. I have 20 outputs, is there any command that can make all the outputs HIGH or LOW at once ?

Nothing really happens all at once, but you can use a FOR loop to cycle through an array of all your pins and make them HIGH or LOW.

OR you can look into Direct Port Manipulation.

HazardsMind: OR you can look into Direct Port Manipulation.

But even then, it'll take more than one statement to set 20 outputs. If you really do need the switching to be simultaneous, consider using shift registers.

You can almost certainly write all 20 outputs using digitalWrite in less time than it would take a human to notice the lag.

Concentrate on making them failsafe, not fast.

portb = 255 it will force it all 8 pins to be high also the portb = B%11111111 will do the same ( i have use it with microchip ic should be the same also to the arduino) Also portc = 255 PortD = 255 if exist, e.t.c.

thank you guys for your help !