t keeps saying VALUE does not name type even after putting ((((((((((((( int value;)))))))))))))))))
please help need to take the project tomorrow
thanks
here is my code
const int AOUTpin=0;//the AOUT pin of the CO sensor goes into analog pin A0 of the arduino
const int DOUTpin=8;//the DOUT pin of the CO sensor goes into digital pin D7 of the arduino
const int ledPin=12;//the anode of the LED connects to digital pin D13 of the arduino
int limit;
int value;
const int LED = 13;
const int BUTTON = 7;
int val = 0;
int old_val = 0;
int state = 0;
#include "DHT.h"
float h, t;
DHT DHT_sens(8, DHT11); //datapin sensor to pin 8 Arduino
void setup()
{
pinMode(LED,OUTPUT);
pinMode(BUTTON, INPUT);
Serial.begin(115200);//sets the baud rate
pinMode(DOUTpin, INPUT);//sets the pin as an input to the arduino
pinMode(ledPin, OUTPUT);//sets the pin as an output of the arduino
DHT_sens.begin();
Serial.begin (9600);
Serial.println ("===============================================");
Serial.println (" HUMIDITY, TEMPARATURE AND CO LEVEL MONITOR");
Serial.println ("===============================================");
}
void loop(){
val = digitalRead(BUTTON);
if( val == HIGH && old_val == LOW) {
state = 1-state;
delay (10);
}
old_val = val;
if ( state == 1)
digitalWrite(LED,HIGH);
else
digitalWrite(LED, LOW);
}
value = analogRead(AOUTpin);//reads the analaog value from the CO sensor's AOUT pin
limit = digitalRead(DOUTpin);//reads the digital value from the CO sensor's DOUT pin
Serial.print("CO: ");
Serial.println(value);//prints the CO value
Serial.println("=============================");
if (value > 750) digitalWrite(ledPin, HIGH);
if (value < 750) digitalWrite(ledPin, LOW);
// ================== read from buffer and display =========================
h = DHT_sens.readHumidity();
t = DHT_sens.readTemperature();
delay (1000); // pause a second
Serial.print ("Humidity:");
Serial.print (h,0);
// zero decimal
Serial.print (" %\t");
Serial.print ("Temparature: ");
Serial.print (t,1); // one decimal
Serial.println (" *C");
delay (1000); // pause a second
}
here is my error message
Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"
sketch_for_dht11_heat_sensor:60: error: 'value' does not name a type
value = analogRead(AOUTpin);//reads the analaog value from the CO sensor's AOUT pin
^
sketch_for_dht11_heat_sensor:61: error: 'limit' does not name a type
limit = digitalRead(DOUTpin);//reads the digital value from the CO sensor's DOUT pin
^
sketch_for_dht11_heat_sensor:62: error: 'Serial' does not name a type
Serial.print("CO: ");
^
sketch_for_dht11_heat_sensor:63: error: 'Serial' does not name a type
Serial.println(value);//prints the CO value
^
sketch_for_dht11_heat_sensor:64: error: 'Serial' does not name a type
Serial.println("=============================");
^
sketch_for_dht11_heat_sensor:67: error: expected unqualified-id before 'if'
if (value > 750) digitalWrite(ledPin, HIGH);
^
sketch_for_dht11_heat_sensor:69: error: expected unqualified-id before 'if'
if (value < 750) digitalWrite(ledPin, LOW);
^
sketch_for_dht11_heat_sensor:72: error: 'h' does not name a type
h = DHT_sens.readHumidity();
^
sketch_for_dht11_heat_sensor:73: error: 't' does not name a type
t = DHT_sens.readTemperature();
^
sketch_for_dht11_heat_sensor:76: error: expected constructor, destructor, or type conversion before '(' token
delay (1000); // pause a second
^
sketch_for_dht11_heat_sensor:77: error: 'Serial' does not name a type
Serial.print ("Humidity:");
^
sketch_for_dht11_heat_sensor:78: error: 'Serial' does not name a type
Serial.print (h,0);
^
sketch_for_dht11_heat_sensor:80: error: 'Serial' does not name a type
Serial.print (" %\t");
^
sketch_for_dht11_heat_sensor:82: error: 'Serial' does not name a type
Serial.print ("Temparature: ");
^
sketch_for_dht11_heat_sensor:83: error: 'Serial' does not name a type
Serial.print (t,1); // one decimal
^
sketch_for_dht11_heat_sensor:84: error: 'Serial' does not name a type
Serial.println (" *C");
^
sketch_for_dht11_heat_sensor:85: error: expected constructor, destructor, or type conversion before '(' token
delay (1000); // pause a second
^
sketch_for_dht11_heat_sensor:88: error: expected declaration before '}' token
}
^
exit status 1
'value' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.