-
Notifications
You must be signed in to change notification settings - Fork 0
/
3_Arduino_4.ino
48 lines (34 loc) · 976 Bytes
/
3_Arduino_4.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
int sensorPin0 = A0;
int sensorPin1 = A1;
int sensorPin2 = A2;
int sensorPin3 = A3;
int sensorValue0 = 0;
int sensorValue1 = 0;
int sensorValue2 = 0;
int sensorValue3 = 0;
void setup() {
Serial.begin(9600); //sets serial port for communication
}
void loop()
{
float sensorAverage = 0.0;
float sensorVariance = 0.0;
// read the value from the 4 sensors:
sensorValue0 = analogRead(sensorPin0);
sensorValue1 = analogRead(sensorPin1);
sensorValue2 = analogRead(sensorPin2);
sensorValue3 = analogRead(sensorPin3);
//Print the results
Serial.print("SensorValue 0 = ");
Serial.print(sensorValue0); //prints the values coming from the sensor on the screen
Serial.print("\t");
Serial.print("SensorValue 1 = ");
Serial.print(sensorValue1);
Serial.print("\t");
Serial.print("SensorValue 2 = ");
Serial.print(sensorValue2);
Serial.print("\t");
Serial.print("SensorValue 3 = ");
Serial.println(sensorValue3);
delay(5000);
}