闪灯程序
static int led_run(lua_State *L)
{
GPIO_ToggleBits(LED3_GPIO_PORT, LED3_PIN);
delay(500);
return 1;
}
int main()
{
int i=0;
lua_State *L;
gpio_init();
sys_tick_init();
uart_init();
while(1)
{
L= luaL_newstate();
lua_pushcfunction(L,led_run);
lua_setglobal(L,"myled");
luaL_dostring(L,"myled();");
lua_close(L);
}
}