You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Beskrivelse

 

Denne sensoren måler fuktigheten i jord. Den har to utganger; analog og digital. Sensorfølsomhet kan stilles.

AO: Analog utgang.

DO: Digital utgang.

GND: Tilkobling til jord.

VCC: Tilkobling til strøm (3,3-5 V)

Testing

For å teste hvordan den fungerer kan du koble den opp og lese av inngangene på Arduinoen. Bruk gjerne eksempelkoden fra GitHub som lar deg lese av både analog og digital inngang samtidig.

Read Digital and Analog Example
const int analogIn = A0; // The analog pin we will use
const int digitalIn = 2; // The digital pin we will use

void setup() {
  // Start communication wirh console
  Serial.begin(9600);
  // Set input mode for digial pin
  pinMode(digitalIn, INPUT);
}

void loop() {
  // Read digital input and tell result to user.
  Serial.print("Digital: ");
  if (digitalRead(digitalIn) == HIGH) {
    Serial.print("High\t");
  } else {
    Serial.print("Low\t");
  }
  
  // Read analog input and tell result to user.
  Serial.print("Analog: ");
  Serial.println(analogRead(analogIn));
  // Wait for 1 second before next read
  delay(1000);
}
  • No labels