//define neopixel ring #include #ifdef __AVR__ #include #endif #define PIN 6 #define NUMPIXELS 16 Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 100 //define big sound const int MIC = 0; //the microphone amplifier output is connected to pin A0 int adc; int dB, PdB; //the variable that will hold the value read from the microphone each time void setup() { Serial.begin(9600); //sets the baud rate at 9600 so we can check the values the microphone is obtaining on the Serial Monitor pinMode(3, OUTPUT); #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif pixels.begin(); } void loop(){ pixels.clear(); PdB = dB; //Store the previous of dB here adc= analogRead(MIC); //Read the ADC value from amplifer //Serial.println (adc);//Print ADC for initial calculation dB = (adc+83.2073) / 11.003; //Convert ADC value to dB using Regression values pixels.clear(); if (PdB!=dB) //Serial.println ("les db sont de:",dB); Serial.println (dB); if (dB>50) //define db for turn the neopixel LED on high { digitalWrite(3, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(3, LOW); for(int i=0; i