赞
踩
提示
编译、烧写、运行、查询后→
说明应用程序运行是在HOS_SystemInit();完成的。
- //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"
-
- ]
-
- }
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。