do{
if(Button(&PORTB,5,1,0))
{
Delay_ms(200); // If button is pressed, delay 0,2s and increment "number" with 1;
number = number +1;
Above code is working fine, that code is counting by button pressed 1 time then increase value till xValue, now I change the button and added an opto coupler, what I mean is when opto coupler have a trigger voltage then counting for 1 time and next trigger and counting.
The trigger only 1 second then off to counting, next trigger will count again.
Hola BradtheRad,
I wish for the count to continue only while the button is sending, it mean when the button on pressed/toggle it count +1 only till the button release (only have one count), and next counting will count same.
I use an opto coupler to trigger an input, so I change
Code:
if(Button(&PORTB,5,1,0))
3 digit (0 to 1).
On my first post if I use that method, always counting when the button on pressed or toggle.