[Ai-WB2] 有手就行,WSL下开发环境搭建
https://bbs.ai-thinker.com/forum.php?mod=viewthread&tid=45163&fromuid=13138
(出处: 物联网开发者社区-安信可论坛)
上次搭建好了开发环境,这次就来点个灯。
准备代码
在~/Ai-Thinker-WB2/applications/get-started/blink目录下就有代码。直接拿来用。
#include <stdio.h>
#include <string.h>
#include <FreeRTOS.h>
#include <task.h>
#include <bl_gpio.h>
#define GPIO_LED_PIN 3
void blink_test(void *param)
{
uint8_t value = 1;
while (1)
{
bl_gpio_enable_output(GPIO_LED_PIN, 0, 0);
printf("Turning the LED %s! \r\n", value == 1 ? "ON" : "OFF");
bl_gpio_output_set(GPIO_LED_PIN, value);
value = !value;
vTaskDelay(1000);
}
}
void main(void)
{
xTaskCreate(blink_test, "blink", 1024, NULL, 15, NULL);
}
编译烧录

烧录先要让wb2进入烧录模式,按住brun键不松,再按rst.在提示要rst时再按rst.

这样就烧录完成了。

手动给板子复位一下。
观察现象

完成,简简单单! |