Back to Parent

int ledPin=9;
int ledVal=0; 
int micPin=0;
int micVal=0;

void setup() {
  pinMode(ledPin, OUTPUT);
  analogWrite(ledPin, ledVal);
  Serial.begin(9600);

}

void loop() {
  micVal= analogRead(micPin);
  Serial.println (micVal);
  
  if (micVal<100)
  {
    ledVal = 255;
    delay(100);
    while(ledVal > 0)
    {
      ledVal = ledVal - 1;
      analogWrite(ledPin, ledVal); 
      delay(10);    
    }
  }

  
}
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0