北冥小海鸥 发表于 2017-11-19 21:06 |
bigfanofloT 发表于 2017-11-19 20:57 谢谢大哥,我看了你是博士好厉害啊,小弟是硕士 |
延时使用gizGetTimerCount,代码参考微信宠物屋的 void userHandle(void) { uint8_t ret = 0; static uint32_t thLastTimer = 0; currentDataPoint.valueInfrared = irHandle(); if((gizGetTimerCount()-thLastTimer) > SAMPLING_TIME_MAX) { ret = dht11Read((uint8_t *)¤tDataPoint.valueTemperature, (uint8_t *)¤tDataPoint.valueHumidity); if(ret != 0) { printf("Failed to read DHT11\r\n"); } thLastTimer = gizGetTimerCount(); } } |
版权与免责声明 © 2006-2024 Gizwits IoT Technology Co., Ltd. ( 粤ICP备11090211号 )