Blink led with a button

I want to put the led on when the button is pushed…But I have some problem with the language on the software…

If I write in void loop

val= digitalread (inpin); // read input value
if (val== HIGH) // check if the input is HIGH (Button released)
digitalwrite (ledpin, LOW); // Turn LED off
else
digitalwrite (ledpin, HIGH); // turn LED on

I have the opposite that I want… The led Turns on always and it turns off when I push the button…
Where do I change the value HIGH and LOW??
Please somebody answer me… :stuck_out_tongue:

It depends on what your circuit looks like, but usually pushbuttons are inverted logic, because they are pulled up to VCC using a resistor and shorted temporarily to ground when the button is pressed. In such a configuration, the switch is "active low", e.g. it's 0V when pressed and 5V otherwise.

-j