#include const int dataPin = 2; // Connect the data pin to digital pin 2 SDI12 sdi12; void setup() { Serial.begin(9600); sdi12.begin(dataPin); } void loop() { // Request data from the sensor sdi12.sendCommand("0M!"); // Wait for the sensor to respond delay(1000); // Read and print the sensor response while (sdi12.available()) { char c = sdi12.read(); Serial.print(c); } // Wait for a moment before taking the next reading delay(5000); }