Want leds strip, model WS2812B, to turn on with my voice and turn off when I sto

Hello. I’m new to coding. I wanted to my leds strip model WS2812B to turn on with my voice and turn off when I stop talking. I connected my led to the power supply and connected a microphone sensor to my arduino uno. Also how can you make it turn on if I say “On” and make it turn off when I say “off”.

#include <FastLED.h>

int r=252;
int g=0;
int b=0;

#define LED_PIN     7
#define NUM_LEDS    150

CRGB leds[NUM_LEDS];
CRGB led[NUM_LEDS];
int s=0;

void setup() {

  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
  for (int i = 74; i >= 0; i--) 
  {
     leds[i] = CRGB ( r,g,b);
     leds[149-i] = CRGB (r,g,b );
     FastLED.show();
     delay(40);

  }
  Serial.begin(9600);
  Serial.println("Ready    ");
  
   pinMode(A0,INPUT);

}
void loop()
{
  s=analogRead(A0);
  Serial.println(s);
  
  if((s>=20)&&(s<=30))
  {
    leds[74]=CRGB (20, 135, 217);
    leds[75]=CRGB (20, 135, 217);
  }
  else if((s>=40)&&(s<=100))
   {
     leds[74]=CRGB (20, 217, 30);
    leds[75]=CRGB (20, 217, 30);
   }
  else
  {
     leds[74] = CRGB ( r,g,b);
     leds[75] = CRGB ( r,g,b);
  }
    for (int i = 0; i <= 74; i++) 
  {
     leds[i] = leds[i+1];
     leds[149-i] = leds[148-i];
     
  }
 FastLED.show();
 delay(30);

  
  
 
}

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR

Then look down to "code problems" about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

I would suggest you go and edit your subject to something like;

"Want leds strip, model WS2812B, to turn on with my voice and turn off when I stop talking. "

You will get more forum members helping you.

Tom.... :slight_smile:

Turning the LEDs on and off to the presence of absence of sound is not so hard. Just use a microphone connected to an analog port. Compare the incoming sound level (ADC counts) to a threshold.

Turning on and off a display with certain words is much much more difficult. Google "Arduino voice recognition" for some ideas.

@jorge132345

Topics on the same project merged

Why did you start a second topic ?

@jorge132345

Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting has resulted in a time out from the forum.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

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