I hope someone can help because I am really confused :(

I have some code that I am ruuning on an Arduino to start a race - Take your marks, Get set, Go - type of thing and some LED's that act in a very similar way to the light tree for drag racing. Everything is working ok at the moment with wires connecting the paripherals. However, I would like to seperate the lightsout using 2 ESP-32's and ESP-NOW, so that I can go wireless on the lights.

Currently, I have a couple of .h and ,cpp files to handle both the sequencing and the FastLED's. What I am trying to achieve is to have the ESP-32 receiver as a dumb node that just receives the serial output data that would normally go to the defined PIN via ESP-NOW.

The documentation for ESP-NOW shows using a typedef struct{} to transmit the data and if I use something like -

typedef struct RGB_steps {
  byte Red;
  byte Green;
  byte Blue;
  byte steps[NUMSTEPS];
} RGB_steps;


for (led=0; led<NUMLEDS; led++) {
        if (seq[led].steps[p] == 1)
          neopixel.setPixelColor(led, seq[led].Red, seq[led].Green, seq[led].Blue);
          neopixel.setPixelColor(led, 0, 0, 0);        

Including everything in the main.ino, I am able to populate the struct for transmittion (taken from the example Click Here). This seems to work by sending the individual solors to each LED along with the sequence pattern.

However, I can't seem to get my switch case() to a struct for some reason, I hope it's just me being an idiot :) The sequence.cpp is

Sequence::Sequence(LightShow* lightshowOb) {
  lightshow = lightshowOb;

void Sequence::begin_sequence() {
  uint8_t step = 0;
  uint32_t offset;
  uint32_t now = 0;
  int8_t val;

  offset = millis();

  while(step < count) {

    // a tight loop that waits the target amount of time
    while (target[step] > now) {
      now = millis() - offset;

    for (int i=0; i<3; i++){
      val = seq[step][i];
      // -1 means ignore

      if (val >= 0){
        // 0 = lighSHOW
        if (i == 0){


And the lightshow.cpp is

void LightShow::light_set(int step) {
  serial_print_val("Set LED ", step);

      int position = 4-step;    // bottom of strip up
      // int position = step-1; // top of strip down

      switch (step) {       
        case 1:
          // set team Red LEDs
          for(int i=0;i<team_size;i++) {
            leds[i+position*team_size] = CRGB::Red;
        case 2:
          // set team Orange LEDs
          for(int i=0;i<team_size;i++) {
            leds[i+position*team_size] = CRGB::Yellow;
        case 3:
          // set 2nd team Orange LEDs 
          for(int i=0;i<team_size;i++) {
            leds[i+position*team_size] = CRGB::Orange;
        case 4:
          //set team Green LEDs
          for(int i=0;i<team_size;i++) {
            leds[i+position*team_size] = CRGB::Green;

When I run the code on a single board and view the serial monitor it reads

Set LED 1
Set LED 2
Set LED 3
Set LED 4

with the sequence and timing attached. What is confusing me is that in the example above that I am able to get working, I am just sending individual colors to individual LED's whereas, my code assigns a color to a group of LED's based on team_size. The typedef struct {} above doesn't work as it is just single colors or am I missing something?

Any help would be greatly appreciated.


thanks to information

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.