title: Verilog - incrementing variable using buttons
body: <p>I'm actually trying for 3 days to make my code works. I have an dev board with multiplexed 7-seg display - it's working. The problem is, when I'm trying to increment a variable. I written code below:</p>
  
  <pre><code>assign buttons =  debouncedL  | debouncedR;
  
  always @(posedge buttons or negedge RES) begin
      if(~RES) number &lt;= 0;
      else if(debouncedL) number &lt;= (number + 10);
      else if(debouncedR) number &lt;= (number + 1);
  end
  </code></pre>
  
  <p>And it's not working. When I'm pressing R button, variable is incremented by 1, but when I'm pressing L nothing happens. After changing positions of both <code>else if</code>, L button still not work and displayed number is toggling between 0000 and 0001 after pressing R button. It might be newbie question, but I can't find solution in book and on Internet. Can you help me? Thank you in advance.</p>