コード例 #1
0
  // Continously reads the IR temperature sensor every 1 minute for
  // both object and ambient temperature, and compares the two.
  // Sounds alarm if object temp is higher than set temp.
  void senseTemp(){
    for(;;) {
      cout << "Ambient temp: " << std::fixed << setprecision(2)
           << temps->ambientTemperature()
           << " C, Object temp: " << temps->objectTemperature()
           << " C" << endl;

      float temp1 = temps->objectTemperature();

      if(temp1 >= myTemp){
        alarm();
        notify();
      }
      else
        sleep(60);
    }
  }
コード例 #2
0
 // Reads the IR temperature sensor
 float objectTemperature(){
   return temps->objectTemperature();
 }