123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #include "iot_boardled.h"
- #include "iot_boardbutton.h"
- #include "iot_sntp.h"
- #include "ohos_init.h"
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <stdbool.h>
- #include "red.h"
- #include <math.h>
- #include "iot_gpio.h"
- void EntryMain(void)
- {
- float ad_value1;
- float ad_value2;
- BoardInit();
- osDelay(100);
- printf("=================================================\r\n");
- printf("************* human_detect_example ***********\r\n");
- printf("=================================================\r\n");
- for(;;)
- {
-
- float tempNTC;
- float tempTP;
- IoTGpioSetOutputVal (12,1);
- osDelay(50);
- ad_value1 = GetVoltage();
- tempNTC = TEMP1();
- printf("+++***@@@ ad_value is %fV\r\n",ad_value1);
-
- IoTGpioSetOutputVal (12,0);
- osDelay(50);
- ad_value2 = GetVoltage();
- tempTP = HUMAN();
- printf("+++***@@@ ad_value2 is %fV\r\n",ad_value2);
- printf("ntc temp = %f \n",tempNTC);
- printf("tp temp = %f \n",tempTP);
- if (tempTP > 38) {
- BeepStatusSet(ON);
- LedSafeStatusSet(OFF);
- LedWarnStatusSet(ON);
- }else{
- BeepStatusSet(OFF);
- LedSafeStatusSet(ON);
- LedWarnStatusSet(OFF);
-
- }
-
- printf("human temp is %d\r\n",tempTP);
- osDelay(100);
- }
- }
- APP_FEATURE_INIT(EntryMain);
|