title: Simple avr program behaving weirdly "sometimes"
body: <p>I am new to AVR, but i have programmed PICs before, only this time i am doing everything in linux too so you'll guess that i am using avrdude...</p>
  
  <p>My goal for this project is to change a bicolor LED's color depending on a certain state.</p>
  
  <p>By default, the led is RED (if you make the connections right of course), then i want it to go to <strong>yellow</strong> (which is a quick change between green and red) while the user is holding the button down then on release, it will go to green, then the next time it will turn off.</p>
  
  <p>So, to recap, </p>
  
  <p>LED is <strong>red</strong></p>
  
  <p>While i hold the button down its gonna be <strong>yellow</strong></p>
  
  <p>When i release it will be <strong>green</strong></p>
  
  <p>While i hold the button down again its gonna be <strong>yellow</strong></p>
  
  <p>When i release it will be <strong>off</strong></p>
  
  <p>While i hold the button down again its gonna be <strong>yellow</strong></p>
  
  <p>When i release it will be <strong>red</strong> (and so on...)</p>
  
  <p>In my actual code, everything works really well sometimes, but sometimes the led gets stuck at yellow and i have no clue why</p>
  
  <p>Any ideas?</p>
  
  <p>Code is on ideone : <a href="http://ideone.com/LI9gH" rel="nofollow">http://ideone.com/LI9gH</a></p>
  
  <p>Thanks </p>