Code uploaded successfully but no error or print value on Serial monitor

I want to use NodeMCU(ESP8266) and Sound Sensor(k-38). I just to want to make an led on and off. I am following this link and here is the code.

int led = D7;
int sound_digital = D8;
int sound_analog = A0;

void setup(){
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  pinMode(sound_digital, INPUT);  
}

void loop(){
  int val_digital = digitalRead(sound_digital);
  int val_analog = analogRead(sound_analog);

  Serial.print(val_analog);
  Serial.print("\t");
  Serial.println(val_digital);

  if (val_digital == HIGH)
  {
    digitalWrite (led, HIGH);
    delay(3000);
    }
  else
  {
    digitalWrite (led, LOW);
    }
}

Code uploaded successfully, cross checked multiple times its wiring but no error or print value on Serial monitor(using Arduino IDE) and no LED blink. Please help me to understand the issue. Ultimately, I want to build music reactive LED strip(single color, 2 wires) with NodeMCU and Sound Sensor. I spent my whole day but no success. Guide me. Thanks. Link

did you open the Serial monitor at 9600 bauds?

A useful tip is to always print something after setting up the serial setting to check that it’s working ok.

Serial.begin(9600);
Serial.Println( “go!”);

Then you can quickly find the error .For the serial monitor , are you selecting the right com port , and as said baud rate?

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