Reformat code so that serial.begin and delays are in header file.
This commit is contained in:
parent
566fcda0cc
commit
83fe6d5d7d
@ -3,9 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
setupCapacitiveSoilMoistureSensor();
|
setupCapacitiveSoilMoistureSensor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
loopCapacitiveSoilMoistureSensor();
|
loopCapacitiveSoilMoistureSensor();
|
||||||
|
delay(1); // delay in between reads for stability
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,9 +12,6 @@ int average = 0; // the average
|
|||||||
int inputPin = 12;
|
int inputPin = 12;
|
||||||
|
|
||||||
void setupCapacitiveSoilMoistureSensor() {
|
void setupCapacitiveSoilMoistureSensor() {
|
||||||
|
|
||||||
Serial.begin(9600);
|
|
||||||
|
|
||||||
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
|
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
|
||||||
readings[thisReading] = 0;
|
readings[thisReading] = 0;
|
||||||
}
|
}
|
||||||
@ -39,5 +36,4 @@ void loopCapacitiveSoilMoistureSensor() {
|
|||||||
// calculate the average:
|
// calculate the average:
|
||||||
average = total / numReadings;
|
average = total / numReadings;
|
||||||
Serial.println(average);
|
Serial.println(average);
|
||||||
delay(1); // delay in between reads for stability
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user