[i=s] 本帖最后由 物联网 于 2024-5-5 18:16 编辑 [/i]<br />
<br />
点灯
环境搭建
安装依赖
sudo apt-get install make gcc vim cmake git ninja-build -y

克隆SDK
git clone -b master [https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git](https://gitee.com/Ai-Thinker-Open/AiPi-Open-Kits.git)

下载安信可SDK
修改.gitmodules 文件,把里面github 改成 gitee 我这里访问不到github

git submodule init
git submodule update
cd aithinker_Ai-M6X_SDK/

. install.sh

. export.sh

切换的 此目录
aithinker_Ai-M6X_SDK/examples/helloworld
修改main.c 文件
#include "bflb_mtimer.h"
#include "bflb_gpio.h"
#include "board.h"
struct bflb_device_s *gpio;
int main(void)
{
board_init();
gpio = bflb_device_get_by_name("gpio");
/*初始化RGB灯,IO15,对应蓝灯*/
bflb_gpio_init(gpio, GPIO_PIN_15, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
while(1)
{
bflb_gpio_set(gpio, GPIO_PIN_15);//将pin0设置为高电平
bflb_mtimer_delay_ms(2000);//延迟2000毫秒,也就是2秒
bflb_gpio_reset(gpio, GPIO_PIN_15);
bflb_mtimer_delay_ms(2000);//延迟2000毫秒,也就是2秒
}
}
点灯完成

|