ESP8266 wled with 24 bit LED ring help

Hi, I’m working on a project using an ESP8266 with wled installed on it, I’m using an led ring with 24 leds on it and have been having fun messing around with them but now I have a project I need it for. I’m basically making a bike back light as I don’t have one and I thought it would be fun to make my own with some unique features like turn signals a brake light. I need a way to change the flashing red light to solid red when I hit the brakes on my bike and need like some kind of button for turn signals on the handle bars, I’m a bit lost though as to how to do that, with the code and the hardwear side of things and was hoping someone could help.

There have been a few threads talking about turn-signal setups.

A quick search turned up: Turn-Signal implementation

That may give you some ideas.

@mr_chef1 You know that the police will fine you if you got somthing like this
Backlight is sopost to be red in some way blinking for less power consuntion
the rest like a light show can cost you in some countrys the CAR license and a very large fine
if you are on public roads

BESIDE try using offset and grouping spacing
like in the WLED Wiki
https://kno.wled.ge/features/segments/

I’m not trying to have a light show on the back of my bike, I’ve just had some problems with biking with friends and nobody knowing when someone is braking. thought it would be nice to signal that I’m braking with the bike light. the turn signals I thought would just be nice to have, don’t really need them though it would just help with letting my friends know were we are going to be going and when to turn.

you cout do a simple arduino projekt on a nano with speedsensor levelsensor and FASTLED or ADAFRUIT_pixel this makes it “AUTO” without doing anything just on level sensor and speedsensor

the projekt can be runned entirerly on a 9V Block ir S2 Lipo as the led currnent meeds the Nano limit

well, I don’t have any of that stuff but I was just thinking earlier today if I could just code it on arduino and you can upload arduino code to an ESP board which will give me the obillity to control it from my phone if I ever need/want to, but I don’t know how to split the led ring into segments on arduino to control each part of the led ring separately, do you know how I could do this?
and thank you for the help btw

@mr_chef1 use EASY ESP it has all you need in setup
sorry i forgot there is a advance that integreted this Modul already into WLED
look here for more infos

do you know how to make segments on arduino for led strips/ring, my led ring has 24 leds and I want to use top half for the brake lights and flashing when I’m not braking and the and the bottom half for the turn signals, the setup would t10 flashing red unless braking, ten solid red when braking, 5 flashing orange/yellow when turning left, and another 5 flashing orange/yellow when turning right with 2 leds on either side to seperate the braking light from the turn signals.

this very simple Progeamming

here is a small Example WS2812b fastled - General Electronics - Arduino Forum

You do not need segments in ARDUINO its the main loop() calls the subprogramm in sensor or whatever behavior like if levelsens < 100{left()}
this then sets the LED’s
like

void left() {
for(int i=8; i< 12; i++){
     leds[i].setRGB(255, 0, 0);
     FastLED.show(); 
   }
}

void right() …

so all is in main loop

that looks very promising, thank you, this is how I was coding it before

#include <FastLED.h>

#define LED_PIN 9
#define NUM_LEDS 24

CRGB leds[NUM_LEDS];

void setup() {
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);

//step 1
leds[0] = CRGB(0,0,255);
FastLED.show();
leds[23] = CRGB(0,0,255);
FastLED.show();
leds[11] = CRGB(0,0,255);
FastLED.show();
leds[12] = CRGB(0,0,255);
FastLED.show();
delay(50);

//step 2
leds[1] = CRGB(255,0,0);
FastLED.show();
leds[22] = CRGB(255,55,0);
FastLED.show();
leds[10] = CRGB(255,0,0);
FastLED.show();
leds[13] = CRGB(255,55,0);
FastLED.show();
delay(50);

//step 3
leds[2] = CRGB(255,0,0);
FastLED.show();
leds[21] = CRGB(255,55,0);
FastLED.show();
leds[9] = CRGB(255,0,0);
FastLED.show();
leds[14] = CRGB(255,55,0);
FastLED.show();
delay(50);

//step 4
leds[3] = CRGB(255,0,0);
FastLED.show();
leds[20] = CRGB(255,55,0);
FastLED.show();
leds[8] = CRGB(255,0,0);
FastLED.show();
leds[15] = CRGB(255,55,0);
FastLED.show();
delay(50);

//step 5
leds[4] = CRGB(255,0,0);
FastLED.show();
leds[19] = CRGB(255,55,0);
FastLED.show();
leds[7] = CRGB(255,0,0);
FastLED.show();
leds[16] = CRGB(255,55,0);
FastLED.show();
delay(50);

//step 6
leds[5] = CRGB(255,0,0);
FastLED.show();
leds[18] = CRGB(255,55,0);
FastLED.show();
leds[6] = CRGB(255,0,0);
FastLED.show();
leds[17] = CRGB(255,55,0);
FastLED.show();
delay(50);
}

void loop() {
if () {
leds[0] = CRGB(0,0,255);
FastLED.show();
leds[1] = CRGB(255,0,0);
FastLED.show();
leds[2] = CRGB(255,0,0);
FastLED.show();
leds[3] = CRGB(255,0,0);
FastLED.show();
leds[4] = CRGB(255,0,0);
FastLED.show();
leds[5] = CRGB(255,0,0);
FastLED.show();
leds[6] = CRGB(255,0,0);
FastLED.show();
leds[7] = CRGB(255,0,0);
FastLED.show();
leds[8] = CRGB(255,0,0);
FastLED.show();
leds[9] = CRGB(255,0,0);
FastLED.show();
leds[10] = CRGB(255,0,0);
FastLED.show();
leds[11] = CRGB(0,0,255);
FastLED.show();
leds[12] = CRGB(0,0,255);
FastLED.show();
leds[13] = CRGB(255,55,0);
FastLED.show();
leds[14] = CRGB(255,55,0);
FastLED.show();
leds[15] = CRGB(255,55,0);
FastLED.show();
leds[16] = CRGB(255,55,0);
FastLED.show();
leds[17] = CRGB(255,55,0);
FastLED.show();
leds[18] = CRGB(255,55,0);
FastLED.show();
leds[19] = CRGB(255,55,0);
FastLED.show();
leds[20] = CRGB(255,55,0);
FastLED.show();
leds[21] = CRGB(255,55,0);
FastLED.show();
leds[22] = CRGB(255,55,0);
FastLED.show();
leds[23] = CRGB(0,0,255);
FastLED.show();
delay(500);
}else if () {

}else if () {

}else if () {

}
}
just so I could get somewhere, took the code from a previous project… still coding it though but I think I’ll try your way and save mine as a last resort.

btw, how would I do that with 2 buttons for left and right and a flip switch for brakes (I’m guessing I could just use the same code from the buttons for the switch)

ok so you can do it
You can make this a quite cool thing using your smartphone sensors
VIA a HC-05 to your Arduino
If you are like a Semi pro you can do a APP that graps the Speed and level sensor of yopur phone and send it to the Arduino that acts on this sensors
The app shoudt also got the responding buttons for manuell override
and you can go MAD by color and effects
this will shure generate some Downloads

so what I have (and will probably be using) is a LOT of arduino boards (specificly arduino uno r3), an ESP32 DEVKIT V1, an ESP8266, two buttons (I’ll probably just use one), a flip switch, a 24 bit led ring, and a LOT of wires, oh and like 6 different ways to power it.

oh yeah, and I know how to solder and have the stuff for that

ok, I think I might be doing something wrong, I’m kinda new to custom voids…

#include <Adafruit_NeoPixel.h>
#define PIN 9 // input pin Neopixel is attached to
#define NUMPIXELS 24 // number of neopixels in strip
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

const int colorAmount = 3;
const int button = 8;
const int Switch = 8;
int colors[colorAmount][3] = {{255,0,0},{255,255,0},{0,0,255}};
int addVal = 0; //no change
int delayVal = 50;
int Mode = 1;

void setup() {
pixels.begin();
pinMode(9, OUTPUT);
}

void loop() {
void StandBy() {
for (int i=0; i<1; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=1; i<11; i++) {int index = i+addVal; int r = 255; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=11; i<13; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=13; i<18; i++) {int index = i+addVal; int r = 255; int g = 55; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=18; i<23; i++) {int index = i+addVal; int r = 255; int g = 55; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=23; i<24; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
pixels.show();
addVal++;
delay(delayVal);
}

void Brakes() {

}

void Right() {

}

void Left() {

}

if (button == HIGH && Mode == 1) {
voidStandBy()
}else if(button == HIGH && Mode == 2) {
voidBrakes()
}else if(button == HIGH && Mode==3 && Switch == HIGH) {
voidRight()
}else if(button == HIGH && Mode == 3 && Switch == LOW) {
voidLeft()
}
}

Changed the code a bit but the buttons and switch aren’t working

#include <Adafruit_NeoPixel.h>
#define PIN 9 // input pin Neopixel is attached to
#define NUMPIXELS 24 // number of neopixels in strip
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

const int colorAmount = 3;
const int button1 = 10;
const int button2 = 11;
const int Switch = 8;
int buttonState1 = 0;
int buttonState2 = 0;
int switchState = 0;
int colors[colorAmount][3] = {{255,0,0},{255,255,0},{0,0,255}};
int addVal = 0; //no change
int delayVal = 250;
int Mode = 1;
int PressDelay = 25;

void setup() {
Serial.begin(9600);
pixels.begin();
pinMode(9, OUTPUT);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(Switch, INPUT);
}

void loop() {
buttonState1 = digitalRead(button1);
buttonState2 = digitalRead(button2);
switchState = digitalRead(Switch);

if (button1 == HIGH) {
delay(PressDelay);
Serial.println("button pressed: ");
if (Mode<3) {
Mode++;
}else if(Mode>=3) {
Mode = 1;
}
}else if(button2 == HIGH) {
delay(PressDelay);
if (Mode == 2) {
Mode++;
}else if(Mode == 1) {
Mode = 3;
}else if(Mode == 3) {
Mode = 1;
}
}
Serial.print(Mode);
if (Mode == 1) {
for (int i=0; i<1; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=1; i<11; i++) {int index = i+addVal; int r = 255; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=11; i<13; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=13; i<18; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=18; i<23; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=23; i<24; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
pixels.show();
addVal++;
delay(delayVal);
for (int i=0; i<1; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=1; i<11; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=11; i<13; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=13; i<18; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=18; i<23; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=23; i<24; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
pixels.show();
addVal++;
delay(delayVal);
}else if(Mode == 2) {
for (int i=0; i<1; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=1; i<11; i++) {int index = i+addVal; int r = 255; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=11; i<13; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=13; i<18; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=18; i<23; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=23; i<24; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
pixels.show();
addVal++;
}else if(Mode == 3 && Switch == HIGH) {
for (int i=0; i<1; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=1; i<11; i++) {int index = i+addVal; int r = 255; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=11; i<13; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=13; i<18; i++) {int index = i+addVal; int r = 255; int g = 55; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=18; i<23; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=23; i<24; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
pixels.show();
addVal++;
delay(delayVal);
for (int i=0; i<1; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=1; i<11; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=11; i<13; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=13; i<18; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=18; i<23; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=23; i<24; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
pixels.show();
addVal++;
delay(delayVal);
}else if(Mode == 3 && Switch == LOW) {
for (int i=0; i<1; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=1; i<11; i++) {int index = i+addVal; int r = 255; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=11; i<13; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=13; i<18; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=18; i<23; i++) {int index = i+addVal; int r = 255; int g = 55; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=23; i<24; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
pixels.show();
addVal++;
delay(delayVal);
for (int i=0; i<1; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=1; i<11; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=11; i<13; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=13; i<18; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=18; i<23; i++) {int index = i+addVal; int r = 0; int g = 0; int b = 0; pixels.setPixelColor(i, pixels.Color(r,g,b));}
for (int i=23; i<24; i++) {int index = i+addVal; int r = 25; int g = 0; int b = 25; pixels.setPixelColor(i, pixels.Color(r,g,b));}
pixels.show();
addVal++;
delay(delayVal);
}
}

if you could help that would be very much appreciated
also if you could help make it a little more compact to run faster that would also be great, thank you

@mr_chef1 TRY this ARATION the LED Ring is on PIN4
in IARDUINO DE Monitor Tyoe L for Left blink R… or S blink Stop B for break

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> 
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN        4 

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 24


Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int incomingByte = 0; // for incoming serial data
boolean blink = 0;
boolean ison = 0;
int blinkcount = 4;  // 4 times 1sec
// segments
int leftpixels[7]={0,1,2,3,4,5,6};
int toppixels[6]={7,8,9,10,11,12};
int rightpixels[6]={13,14,15,16,17,18};
int downpixels[6]={19,20,21,22,23,24};
int level=0;
//color
uint32_t red = pixels.Color(255, 0,0);
long previousMillis; // will store last time pixel was updated
unsigned long currentMillis; 
const long interval = 1000; // Länge der Pause in ms

void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
 pixels.begin(); // INITIALIZE NeoPixel pixels object (REQUIRED)
 pixels.setBrightness(25);
}

void loop() 
{

  currentMillis = millis();
  //wait Blink
  if (currentMillis - previousMillis >= interval) { 
     previousMillis = currentMillis; // Zeitpunkt der letzten Schaltung wird festgehalten 
     if (!ison && blink){
      pixels.clear();
      pixels.show();}
     else{
      //Serial.print("on \n ");
      switch(level){
      case 1 : {left();
      break;}
       case 5 : {stop(true);
      break;}
     }
     }
ison=!ison;     
  }

  if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial.read();

    // say what you got:
    Serial.print("I received: ");
    Serial.println(incomingByte);
  }
  
  switch (incomingByte)
     {
      case 76 : {left(); // 'L'
      break;}
      case 82 : {right(); //'R'
      ;break;}
      case 83 : {stop(true); // 'S'
      ;break;}
      case 66 : {stop(false); // 'B'
      ;break;}

     default :  pixels.clear(); // Set all pixel colors to 'off'
}

}

void left(){
  level=1;
  pixels.clear(); // Set all pixel colors to 'off'
  for (int i=0;i<sizeof(leftpixels)/sizeof(int);i++){
    pixels.setPixelColor(leftpixels[i],pixels.Color(209,134,0)); 

  }
  blink=true;
    pixels.show();
}

void right(){
  pixels.clear(); // Set all pixel colors to 'off'
  for (int i=0;i<sizeof(rightpixels)/sizeof(int);i++){
    pixels.setPixelColor(rightpixels[i], pixels.Color(209,134,0));  
  }
  pixels.show();
}

void stop(boolean doblink){
  if (doblink)level=5;
  else level = 0;
  blink=doblink;
  pixels.fill(red,0,24); // 
  pixels.show();
  
}

I always seem to have problems with AVR code

  1. Don’t use the MS store version of the arduino IDE
  2. You should be using Arduino IDE 2, way better nowadays

was there an update for arduino ide?