The Screenshot represents the data recorded from the microphone, here is my code:
#define FASTLED_ESP8266_RAW_PIN_ORDER
#include <FastLED.h>
#define num_leds 30
#define PIN 7
#define brightness 100 // can set it 0-255
#define sensitivity 1 // can set it 0-10, recommended at 5
CRGB leds[num_leds];
void setup() {
Serial.begin(9600);
FastLED.addLeds<WS2811, PIN, GRB>(leds, num_leds);
FastLED.setBrightness(brightness);
}
void loop() {
int x = analogRead(0);
x = (x * sensitivity);
int y = analogRead(1);
y=y-0;
int d;
Serial.println(y);
//Serial.println(y);
int c = 0;
if (y <= 300 && y > 0) {
if (y > 0 && y < 50) { //2nd up
c = ((y - 0) * (255 / 50));
leds[(num_leds/2)] = CRGB(255, c, 0);
}
else if (y >= 50 && y < 100) { //1st down
c = ((y - 100) * (-255 / 50));
leds[(num_leds/2)] = CRGB(c, 255, 0);
}
else if (y >= 100 && y < 150) { //3rd up
c = ((y - 100) * (255 / 50));
leds[(num_leds/2)] = CRGB(0, 255, c);
}
else if (y >= 150 && y < 200) {//2nd down
c = ((y - 200) * (-255 / 50));
leds[(num_leds/2)] = CRGB(0, c, 255);
}
else if (y >= 200 && y < 250) {//1st up
c = ((y - 200) * (255 / 50));
leds[(num_leds/2)] = CRGB(c, 0, 255);
}
else if (y >= 250 && y <= 300) {//3rd down
c = ((y - 300) * (-255 / 50));
leds[(num_leds/2)] = CRGB(255, 0, c);
}
else {
leds[(num_leds/2)] = CRGB(101, 195, 206);
}
}
else if (y > 300 && y <= 950) {
if (y > 300 && y < 400) { //2nd up
c = ((y - 300) * (255 / 100));
leds[(num_leds/2)] = CRGB(255, c, 0);
}
else if (y >= 400 && y < 500) { //1st down
c = ((y - 500) * (-255 / 100));
leds[(num_leds/2)] = CRGB(c, 255, 0);
}
else if (y >= 500 && y < 600) { //3rd up
c = ((y - 500) * (255 / 100));
leds[(num_leds/2)] = CRGB(0, 255, c);
}
else if (y >= 600 && y <700) {//2nd down
c = ((y - 700) * (-255 / 100));
leds[(num_leds/2)] = CRGB(0, c, 255);
}
else if (y >= 700 && y < 800) {//1st up
c = ((y - 700) * (255 / 100));
leds[(num_leds/2)] = CRGB(c, 0, 255);
}
else if (y >= 800 && y < 950) {//3rd down
c = ((y - 950) * (-255 / 150));
leds[(num_leds/2)] = CRGB(255, 0, c);
}
else {
leds[(num_leds/2)] = CRGB(229, 89, 231 );
}
}
else {
int a = y;
int d;
while (y > 1000) {
y = analogRead(1);
if (a >= 100 && a < 250) { //2nd up
d = ((a - 100) * (255 / 150));
leds[(num_leds/2)] = CRGB(0, 0, 0);
}
else if (a >= 250 && a < 400) { //1st down
d = ((a - 400) * (-255 / 150));
leds[(num_leds/2)] = CRGB(0, 0, 0);
}
else if (a >= 400 && a < 550) { //3rd up
d = ((a - 400) * (255 / 150));
leds[(num_leds/2)] = CRGB(0, 0, 0);
}
else if (a >= 550 && a < 700) {//2nd down
d = ((a - 700) * (-255 / 150));
leds[(num_leds/2)] = CRGB(0, 0, 0);
}
else if (a >= 700 && a < 850) {//1st up
d = ((a - 700) * (255 / 150));
leds[(num_leds/2)] = CRGB(0, 0, 0);
}
else if (a >= 850 && a < 1000) {//3rd down
d = ((a - 1000) * (-255 / 150));
leds[(num_leds/2)] = CRGB(229, 89, 231 );
}
else {
leds[(num_leds/2)] = CRGB(0, 0, 0);
}
FastLED.show();
delay(60);
fill_solid( leds, num_leds, leds[(num_leds/2)]);
a = a + 0;
if (a > 1023){
a = 0;
}
}
}
FastLED.show();
delay(10);
for (int z = num_leds; z > (num_leds/2); z--) {
leds[z] = leds[z - 1];
}
for (int z = 0; z < (num_leds/2); z++) {
leds[z] = leds[z + 1];
}
}
I understood that the SPI method was the best and fastest in terms of transfer speed, even after reading some tutorial I still remain blocked, I can’t find how to recover the data from the microphone to transfer them to the NodeMCU.
Do you have a solution for me?[quote="UKHeliBob, post:2, topic:862126, full:true"]
A Serial link would be the simplest
What was that picture of the Serial monitor meant to show ? Firstly, please do not post screen shots when you could have copied and pasted the output here and secondly, without seeing you sketch we have no idea what you are doing and how you are going about it
[/quote]