Home > other >  STM32103 series by pressing a button a let it circulating water and then push the second all the LED
STM32103 series by pressing a button a let it circulating water and then push the second all the LED

Time:12-06

CodePudding user response:

The LED light water example of industrial control board change is ok,

CodePudding user response:

Can set a timer, cycle for 10 ms or other will do, and then set a variable, make him in the timer interrupt stack, for example, 10 mode, the superposition is 10 times 100 mode (0.1 s), and the 10 can be set to another variable, and then through the button to change the value of this variable, you'll be able to change cycle interval

CodePudding user response:

KEYFLAG=SCAN ();//read key state
If (KEYFLAG==1)
Flag=1;
Else if (KEYFLAG==2)
Flag=2;
Else if (KEYFLAG==3)
Flag=3;
Else if (KEYFLAG==4)
Flag=4;
The switch (flag)
{
Case 1: N + 100; Flag +=2; break;
Case 2: N - 100; Flag +=1; break;
Case 3:
LED1=1;
DELAY_MS (N);
LED1=0;
. ; break;
Case 4:
LED1=0;
. ; break;
Default: break;
}

CodePudding user response:

I'm doing this, and, while (flag) cycle if read the temper of flag zeros, but because there is a delay while to write not 0.1 0.3 s s read a temper and delay within 0.1 s in 0.3 s can't read, I will only write
  • Related