-
Notifications
You must be signed in to change notification settings - Fork 1
/
Arduino_Code.ino
55 lines (47 loc) · 1.13 KB
/
Arduino_Code.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//Include DHT library
#include <dht.h>
//Defining data pin
#define dataPin A4
dht DHT;
int pressureAnalogPin = 0;
int pressureReading;
int noPressure = 5;
int lightPressure = 100;
int mediumPressure = 200;
String strTemp;
String strHumid;
String strForce;
const int motorPin = 3;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode(motorPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(11,HIGH);
digitalWrite(12,HIGH);
digitalWrite(13,HIGH);
pressureReading = analogRead(pressureAnalogPin);
int readData = DHT.read22(dataPin);
float temp = DHT.temperature;
float humid = DHT.humidity;
strTemp=String(temp);
strHumid=String(humid);
strForce=String(pressureReading);
Serial.print(strTemp+","+strHumid+","+strForce);
Serial.println();
//Serial.print(",");
//Serial.print(humid);
//Serial.print(",");
//Serial.print(pressureReading);
//Serial.print(",");
//Serial.println();
digitalWrite(motorPin, HIGH);
delay(5000);
digitalWrite(motorPin, LOW);
delay(2000);
}