- #include "mcc_generated_files/mcc.h"
- //#include "mcc_generated_files/delay.h"
- #include"util/delay.h"
- int main(void)
- {
- /* Initializes MCU, drivers and middleware */
- SYSTEM_Initialize();
- /* Replace with your application code */
- while (1){
- if(IO_PF6_GetValue()==0)
- {
- _delay_ms(50);
- if(IO_PF6_GetValue()==0)
- IO_PF5_Toggle();
- }
- // _delay_ms(1000);
- // DELAY_milliseconds(1000);
-
- }
- }
在MCC配置PF6为输入接口,就可以使用开发板上的按键了,上面代码是演示如何用按键。当按下按键就会闪烁LDE。
|