You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <Arduino.h>
#line 1 "g:\\course\\wlw\\exs\\code\\ex2\\ex2.ino"
//通过人体红外热释电传感器和超声波测距传感器检测是否有人靠近以及当前距离是否小于30cm基于温湿度传感器采集环境数据通过硬件编程实现所需功能。
const int INFRARED_PIN = 2;
const double DISTANCE = 30.0;
#line 4 "g:\\course\\wlw\\exs\\code\\ex2\\ex2.ino"
void setup();
#line 9 "g:\\course\\wlw\\exs\\code\\ex2\\ex2.ino"
void loop();
#line 21 "g:\\course\\wlw\\exs\\code\\ex2\\ex2.ino"
bool person_closing();
#line 26 "g:\\course\\wlw\\exs\\code\\ex2\\ex2.ino"
double measure_distance();
#line 31 "g:\\course\\wlw\\exs\\code\\ex2\\ex2.ino"
void measure_T();
#line 4 "g:\\course\\wlw\\exs\\code\\ex2\\ex2.ino"
void setup() {
// put your setup code here, to run once:
pinMode(INFRARED_PIN,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (person_closing())
{
if (measure_distance()<DISTANCE)
{
measure_T();
}
}
}
bool person_closing(){
// check if someone closing, outputting result
return digitalRead(INFRARED_PIN)==HIGH;
}
double measure_distance()
{
}
void measure_T(){
}