I've make a simple program with three pushbuttons that should command 3 outputs independently, the problem is, when i push 2 or the 3 buttons simultaneously more than one output is activated.
I only would one.
How are the inputs wired ?
Do you have pulldown resistors in place to keep them LOW when the pushbuttons are not pressed or are they floating at an unknown voltage ?
digitalRead will return either 0 (LOW) or 1 (HIGH), so you can simply set button state like this:
StateX = digitalRead(PinNumber);
Before you check the state of a button, you must figure out if either states are HIGH - the easiest way of doing this is to add all states together and check if the sum is zero:
if (State1+State2 == 0) { read buttons until a HIGH is found }
the problem is, when i push 2 or the 3 buttons simultaneously more than one output is activated.
I only would one.
No, that is not what happens, unless your switches are not wired properly.
What IS happening is that you do NOT set the value of State1, State2 and State3 on every pass through loop(). You only set some of them. So, sometimes you print new data and sometimes you print old data.
You need to separate the setting of State1, State2, and State3, so that they are independent.
Your wiring is OK as it is. The inputs are held LOW by the 10K resistors until the buttons are pressed to take them HIGH. There are ways of using inputs without external resistors but leave them alone for now.
You're going to have to detect state changes if you want to ignore additional button presses until the first one activated is released. So a button gets pressed, action happens, and only when that button is released will the function break to read buttons again.
There is another issue lurking under the surface - the order of priority of the buttons (rollover).
I don't want that two buttons work simultaneously, i just want the first button work and that's all, even when pushing on another button.
The first button, or button #1 ?
There are simple methods - which have been suggested above, but you may need to consider whether button X has precedence over button Y or vice versa.