Paso 2: codificación
// Voice Activated Bulbint soundPin = 0; //The Pin number of the sound sensor int ledPin = 13; //The Pin number of the LED void setup() { pinMode(ledPin, OUTPUT); // Serial.begin(9600); //just for debuging } void loop(){ int soundState = analogRead(soundPin); //Read the analog value from sound sensor // Serial.println(soundState); //Print the value of the sound sensor //If the sound value is greater than 10, light will be turned on. Otherwise it will be turned off. if (soundState > 10) { digitalWrite(ledPin, HIGH); delay(10000); }else{ digitalWrite(ledPin, LOW); } }
Tratar de aplauda, o para decir algo cerca del sensor de sonido. Trate sea la luz se enciende para arriba.