<1>, <2>, :
if (<>)
{
<1>;
}
else
{
<2>;
}
,
(Button_state == 1)
<1> <2> . , .. <1> <2> , :
if (<1>)
{
if (<2>)
{
<3>;
}
}
, Button_state_old Button_state :
if (Button_state_old!= Button_state)
{
}
!= .
Button_state 1 Button_state_old Button_state :
if (Button_state_old!= Button_state)
{
if (Button_state = 1)
{
// , ,
} else
{
// , ,
}
}
.
1) , .
2) , .
.
1. , , .
2. lab1_1.uvproj lab1 1 2.
3. main() while(1).
a. , , .
b. , -. , .
4. 1). ( ) while(1).
a. Button_state ( main()) uint8_t. 0. Button_state : , 1, , 0.
b. while(1) Button_state , .
c. , , , (. if).
d. .
5. 2). ( ) while(1).
a. Button_state Button_state_old ( main()) uint8_t. 0. Button_state : , 1, , 0.
b. while(1) Button_state , .
c. , Button_state Button_state_old, if.
d. , : ( Button_state ).
e. Button_state == 1, : (. ) ( 10 ).
f. , , Button_state_old :
Button_state_old = Button_state;
, .
:
1) .
2) - .
3) .
4) .
5) .