#include <DHT.h>
#include <math.h>
#include <stdlib.h>
#include <stdafx.h>
#include <iostream>
#define DHT1PIN 2
#define DHT1TYPE DHT11 // DHT 11
DHT dht1(DHT1PIN, DHT1TYPE);
void setup();
void loop();
void setup(){
Serial.begin(9600);
Serial.println("DHT11");
dht1.begin();
}
void loop() {
float h1 = dht1.readHumidity();
float t1 = dht1.readTemperature();
if (isnan(t1) || isnan(h1)) {
Serial.println("Failed to read from DHT #1");
} else {
Serial.print("Humidity 1: ");
Serial.print(h1);
Serial.print(" %\t") ;
Serial.print("Temperature 1: ");
Serial.print(t1);
Serial.println(" *C");
delay(1000);
}
}
{ Serial.println ("Ponto 1");
tambiente = t1+273.15;
entalpia = 1.01*t1;
lv = 2538.2+2.91*t1;
hv=lv+1.88*t1;
pfi=h1;
x=(-27405.526+97.5413*tambiente-0.146244*(tambiente*tambiente)+0.00012558*(tambiente*tambiente*tambiente)-0.000000048502*(tambiente*tambiente*tambiente*tambiente))/(4.34903*tambiente-0.0039381*tambiente*tambiente);
pvs=22105649.25*exp(x)/1000;
pv=pfi*pvs/100;
pa=101.325-pv
va=((287,05*(tambiente))/pa)/1000;
uabs=0.6219*pv/(pb-pv);
vv=(461.52*tambiente)/(pv*100)/1000;
tpo=(31.685*log10(pv*1000/613.34))/(1-0.1311*log10(pv*1000/613.34));
hesp=4.1868*(0.24*t2+(597.3+0.441*t2)*uabs);
}
thats a code for school project, i'm getting this error
error: expected unqualified-id before '{' token
those steps of t1, h1 will be repeated till t6,h6. ( i will use 6 sensors) so i want to know if it will be possible also, to get the values like i programmed, as i still couldn't run the program.
any tips to make the program more compact will be well received.