New and need some help.

I'm pretty new to the microprocessor world and the programming world as well and need some help.

is there a command that tell the arduino to wait for an event and the start doing something till that event happens again? Like a button being pressed.

CaveTech: I'm pretty new to the microprocessor world and the programming world as well and need some help.

is there a command that tell the arduino to wait for an event and the start doing something till that event happens again? Like a button being pressed.

There isn't a specific command, but there are ways to do it though standard programming practices. It really depends on what you're looking at doing. Have you looked at the Arduino examples to get an idea of how to write the sketches for them?

Here is a good button example. http://www.ladyada.net/learn/arduino/lesson5.html

CaveTech: is there a command that tell the arduino to wait for an event and the start doing something till that event happens again? Like a button being pressed.

Good advice else-thread, but there is a general notion for what you describe called "interrupt handling". Basically, you can poll for a button press and act on it -- there is nothing wrong with this approach in the infinite loop() of a sketch for a lot of applications. If timing is tricky and you don't want to poll (or can't poll) then you can program using interrupts.

But, start with the basics.

The easiest and simplest method to just stop your program until a button is press is to use a tight "while" loop:

while(digitalRead(3)==LOW);

That will just sit there reading digital pin 3 until it goes "high", i.e., gets connected to +5V.

It's not easy to do anything else while waiting for the button press using this method, but it is a simple method.