How to trigger an moode for neopixel with a button

I am a total noob with coding! At this Moment im trying to implement some moods like a rainbow flow or a strobe mode but i cant seem to implement it right. I am working with a wemos d1 mini and RGB Neopixels. I would like to trigger each mode with a button. Can somebody explain to me how this works?
(By the way if you see any BS in my Code please tell me i want to learn as much as possible, thank you)

#include <Adafruit_NeoPixel.h>
#include <SPI.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266WiFi.h>

#define PIN D4
#define NUMPIXELS 60
#define BLYNK_PRINT Serial 
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup()
{
Serial.begin(9600);
Blynk.begin("+++","++++","+++++");
pixels.begin();
}
BLYNK_WRITE(V2)
{
  int R = param[0].asInt();
  int G = param[1].asInt();
  int B = param[2].asInt();
  Serial.println(R);
  Serial.println(G);
  Serial.println(B);
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(R,G,B));
    pixels.show();
  }
}
void loop()
{
  Blynk.run();
}

Have you seen this project?

Pete.

1 Like

Yes, but as far as i did understand the Code i need an Server.

I’d be surprised if it won’t work with the Blynk cloud server.

Pete.

I did try it but i guess i did not edit the Code right to make it connect to the blynk server:sweat_smile:.
BR

Sounds like you need to start at a simpler level, say blinking an LED, learning how Blynk works, etc… Before jumping to a more advanced level such as balancing Blynk and NeoPixel libraries… both requiring specific timing.

There are lots of NeoPixel codes in this forum, but if you don’t understand the basics it will be like trying to pilot a rocket with only tricycle experience.

1 Like

That is a nice example :joy: