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() {
|
||||
Serial.begin(9600);
|
||||
setupCapacitiveSoilMoistureSensor();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
loopCapacitiveSoilMoistureSensor();
|
||||
delay(1); // delay in between reads for stability
|
||||
}
|
||||
|
||||
@ -12,9 +12,6 @@ int average = 0; // the average
|
||||
int inputPin = 12;
|
||||
|
||||
void setupCapacitiveSoilMoistureSensor() {
|
||||
|
||||
Serial.begin(9600);
|
||||
|
||||
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
|
||||
readings[thisReading] = 0;
|
||||
}
|
||||
@ -39,5 +36,4 @@ void loopCapacitiveSoilMoistureSensor() {
|
||||
// calculate the average:
|
||||
average = total / numReadings;
|
||||
Serial.println(average);
|
||||
delay(1); // delay in between reads for stability
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user