-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFinal_code_1.ino
66 lines (54 loc) · 1.29 KB
/
Final_code_1.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
56
57
58
59
60
61
62
63
64
65
66
#include <SPI.h>
#include "HX711.h"
#define DOUT 4
#define CLK 5
int offset =20;
int weight;
int IR=4;
int V=A0;
int SV = 15;
int B=13;
HX711 scale(DOUT, CLK);
float calibration_factor = -106600;
void setup() {
scale.set_scale(calibration_factor);
pinMode(IR,INPUT);
pinMode(V.INPUT);
pinMode(SV,OUTPUT);
pinMode(B,OUTPUT);
}
void loop() {
weight = scale.get_units()*10; //obtain weight from load cell
//read voltage
int volt = analogRead(V);// read the input
double voltage = map(volt,0,1023, 0, 2500) + offset;// map 0-1023 to 0-2500 and add correction offset
voltage /=100;// divide by 100 to get the decimal Values
if (voltage>6.00)
{
if(digitalRead(IR)==HIGH)
{int wv=client.data();
if(wv == NULL)
{
while(digitalRead(IR)==HIGH)
digitalWrite(SV,HIGH);
}
else{
while((digitalRead(IR)==HIGH)&&(wv>weight))
digitalWrite(SV,HIGH);
}
else
{
digitalWrite(SV,LOW);}
else
{
while( voltage <6.00)
digitalWrite(B,HIGH);
}
}
<<<<<<< HEAD
||||||| merged common ancestors
}
}
}
=======
>>>>>>> a6f50daf7328ddd524f5f8af997c5235da673e0e