Button and LED with different functions.

Hello,

2 things I noticed, first:

digitalRead(BUTTON); //button press add state

This does nothing, you probably want to store the result of this function call into "val", so do:

val = digitalRead(BUTTON); //button press add state

2nd, you do:

if (state = 1)

This is not a test for equality, it's a value assignment. To test equality you have to use

if (state == 1)

Edit: beaten by lloyddean :slight_smile:

You have some logic problems in your code, try to understand what it does.