...
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.
Code Block | ||||
---|---|---|---|---|
| ||||
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);
} |