Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4923

Question about incrementing and holding a value

$
0
0
I've written the below code and I'm wondering why the variable led_state is not holding a shifted value when a button is pressed. Initially bit0 of 4 leds is on then when the button is pressed the led is shifted left so bit1 is on then bit2 then bit3 etc but after a while the led state go's back to bit0. I was expecting when button is 0 it would keep on returning the shifted value. Can anyone tell me why its not? I was thinking that it might have something to do with the scope of led_state...

Question about incrementing and holding a value

Viewing all articles
Browse latest Browse all 4923

Trending Articles