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