Serial monitor do not show result

Hi, I'm facing a problem where the serial monitor is blank, no result. Pretty sure the coding and setting is correct.

Arduino Uno
Moisture sensor

Arduino setting
Board "Arduino Uno"
Port "COM5 Arduino Uno"
Baud 9600

**Code **
i get the code from a website. supposedly it can work, however, on my serial monitor is blank, won't show any result.

int msensor = A1; // moisture sensor is connected with the analog pin A1 of the Arduino
int msvalue = 0; // moisture sensor value 
int led = 13; 
boolean flag = false; 

void setup() {
  pinMode(msensor, INPUT);
  pinMode(led, OUTPUT);  

void loop() {
  msvalue = analogRead(msensor);
  if ( (msvalue >= 500  ) && ( flag == false ) )
  digitalWrite(led, HIGH); 
  flag = true; 

  if ( (msvalue <= 300  ) && ( flag == true ) )
  digitalWrite(led, LOW); 
  flag = false; 

You need to upload the code (Arrow pointing right), not just compile (tick)
It should work then.

thank you!! i do not know i need to click it. [SOLVED]

Happy you got it working.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.