前言
提示
一、实验5:程序启动流程验证
1.按照路径找到这个文件:
2.更改
编译、烧写、运行、查询后→
3.结果实现IPOP:
说明应用程序运行是在HOS_SystemInit();完成的。
二、实验六:代码实现LED灯亮灭
1.目录:新建ch03项目,建立.c BUILD.gn
2.代码如下:
//ch03/led_demo.c
#include<stdio.h>
#include"ohos_init.h"
#include<unistd.h>
#include"wifiiot_gpio.h"
#include"wifiiot_gpio_ex.h"
#include"ohos_types.h"
void leddemo(void)
{
GpioInit();//初始化GPIO设备
IoSetFunc(WIFI_IOT_IO_NAME_GPIO_9,WIFI_IOT_IO_FUNC_GPIO_9_GPIO);
GpioSetDir(WIFI_IOT_IO_NAME_GPIO_9,WIFI_IOT_GPIO_DIR_OUT);
GpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_9,WIFI_IOT_GPIO_EDGE_FALL_LEVEL_LOW);
printf("led点\n");
usleep(4000000);
GpioSetOutputVal(WIFI_IOT_IO_NAME_GPIO_9,WIFI_IOT_GPIO_EDGE_RISE_LEVEL_HIGH);
printf("led熄灭\n");
}
SYS_RUN(leddemo);
//ch03/BUILD.gn
static_library("ch03_demo"){
sources=[
"led_demo.c",
]
include_dirs=[
"//utils/native/lite/include",
"//base/iot_hardware/interfaces/kits/wifiiot_lite",
]
}
//app/BUILD.gn
import("//build/lite/config/component/lite_component.gni")
lite_component("app") {
features = [
"ch03:ch03_demo"
]
}