When I press a button, this button performs a tast once it was pressed and even I release button, it should keep performing the task. But when I release the button, it does not perform the task.
I assign a task to a button. And when I press this button and even if I release the button, I want the button to keep doing its task.
Here is a part of my code:
if (!input(button3)){
buton3_state=1;
} else buton3_state=0,buton3_lock=0;
if (buton3_state==1 && buton3_lock==0)
{
output_low(horn),horn_state=0;
buton3_lock=1;
}
if((input1_state==1 ||input2_state==1 ||input3_state==1 ||input4_state==1 ||input5_state==1 ||input6_state==1)&&(buton3_state==0))
{
horn_state=1;
}
if(horn_state==1){output_high(horn);}