Complete the code to read the soil moisture sensor value.
int sensorValue = analogRead([1]);The soil moisture sensor is connected to analog pin A0, so we use analogRead(A0) to get its value.
Complete the code to print the sensor value to the serial monitor.
Serial.println([1]);The variable holding the sensor reading is sensorValue, so we print that.
Fix the error in the code to initialize serial communication at 9600 baud.
Serial.begin([1]);The standard baud rate for many Arduino serial communications is 9600.
Fill both blanks to create a condition that checks if the soil is dry (sensor value less than 300).
if ([1] [2] 300) { Serial.println("Soil is dry"); }
We check if sensorValue is less than 300 to detect dry soil.
Fill all three blanks to map the sensor value (0-1023) to a percentage (0-100) and print it.
int moisturePercent = map([1], 0, [2], 0, [3]); Serial.print("Moisture: "); Serial.print(moisturePercent); Serial.println("%");
The map function converts the sensor reading from 0-1023 to 0-100 percent.
