简单地使用__delay_cycles来达到延时效果。
#include "./DriverLib/driverlib.h"
int main()
{
WDT_A_hold( WDT_A_BASE ); // 关闭看门狗
GPIO_setAsOutputPin( GPIO_PORT_P1 , GPIO_PIN0 ); // 配置P1.0为输出模式
GPIO_setOutputLowOnPin( GPIO_PORT_P1 , GPIO_PIN0 ); // 让P1.0输出低电平,熄灭LED
while( 1 ){
GPIO_toggleOutputOnPin( GPIO_PORT_P1 , GPIO_PIN0 ); // 切换LED亮灭
__delay_cycles( 1000000 ); // 延时
}
}