| 
 | 
 
請問我的程式裡括號的部分是錯在哪呢,一直找不到答案...... 
可以幫忙修改嗎     
 
#include <DHT.h> 
 
#include <DHT_U.h> 
 
 
 
void setup() 
{ 
#include" DHT.h " 
#define dhtPin 2 //Read DHT11 data 
#define dhtType DHT11 // //Insert DHT11 
#define FAN 8 
#define HOT 9 
#define PERIOD1 10 * 60 * 60 * 1000 //in a few units 
#define PERIOD2 15 * 60 * 60 * 1000 //in millimeters 
#define PERIOD3 25 * 60 * 60 * 1000 
  // millis() returns unsigned long, so we will use it to track 
  Unsigned longer lastTime = 0; 
  / * 
  Temperature control program 
  Maintain 80 degrees for 10 minutes 
  Maintain 70 degrees for 15 minutes 
    Maintain 60 degrees in 25 minutes 
    * / 
    DHT dht (dhtPin, dhtType); //Initialize DHT sensor 
  int stage = 0; 
  Floating point t 
  void setup() 
  { 
    Serial.begin(9600);//Set the baud rate to 9600 
    pinMode (FAN, OUTPUT); 
    pinMode (heat, output); 
    digitalWrite(FAN, LOW); 
    digitalWrite(HOT, LOW); 
    dht.begin(); //Start DHT 
    lastTime = millis(); 
    Stage = 80; 
  } 
  void up() 
  { 
    if (stage >= t - 3) 
    { 
      digitalWrite(FAN, HIGH); 
      digitalWrite(HOT, LOW); 
    } 
    Otherwise (stage <= t - 3) 
    { 
      digitalWrite(FAN, HIGH); 
      digitalWrite(HOT, LOW); 
    } 
    other 
    { 
 
      digitalWrite(FAN, LOW); 
 
      digitalWrite(HOT, LOW); 
 
    } 
  } 
  Invalid loop() 
  { 
    t = dht.readTemperature();//Read the temperature in Celsius 
    float f = dht.readTemperature(true);//Whether read the temperature in Fahrenheit 
    (Isnan(h) || isnan(t) || isnan(f)) 
    { 
      Serial.println("Unable to read from DHT sensor!"); 
      return; 
    } 
    unsigned long now = millis(); 
    if (now - lastTime >= PERIOD1) //every PERIOD count 
    { 
      Stage = 80; 
    } 
    Otherwise if (now - lastTime >= PERIOD2) //every PERIOD count is once 
    { 
      Stage = 70; 
    } 
    else if (now - lastTime >= PERIOD3) //every PERIOD count 
    { 
      Stage = 60; 
    } 
  } 
} |   
 
 
 
 |