RF24 effect interrupt

I have this code which controls one ws2812b led with a nrf24l01+. now I have the problem that with my rainbow code taken from adafruit’s strandtest, when the code is running I have to interrupt it if another message comes from the nrf24l01+ transmitter, to set a solid color or different effect. I reduced the code to just the abort effect function and effect function. please help! thanks.

#include <Adafruit_NeoPixel.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8);
const byte address[6] = "00001";
String received = "";

byte realRed = 0;
byte realGreen = 0;
byte realBlue = 0;

byte previousRed = 0;
byte previousGreen = 0;
byte previousBlue = 0;

byte red = 0;
byte green = 0;
byte blue = 0;
byte brightness = 255;

int effect = 0;
bool transitionDone = true;
bool transitionAbort = false;
int transition = 50;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, 3, NEO_GRB + NEO_KHZ800);

bool shouldAbortEffect() {
  yield();
  return transitionAbort;
}

void rainbow(uint8_t wait) {
  while(true){
  uint16_t i, j;

  for(j=0; j<256; j++) {
    strip.setPixelColor(0, Wheel((i+j) & 255));
    strip.show();
    delay(wait);
    if(shouldAbortEffect()) { return; }
  }
  }
}

ESP_RF24_Digital_LEDs_nojson_one_led.zip (1.73 KB)

What is your question?

Please post a complete code that actually compiles.

gfvalvo: What is your question?

Please post a complete code that actually compiles.

the shouldAbortEffect() Boolean has to either return true or false when there is a new message. in order to break the while loop. and I posted the full code.

Lolimpol: and I posted the full code.

The code you posted contains no setup() or loop() function. It will not compile. It is incomplete. Therefore, it can't be the "full code".

gfvalvo: The code you posted contains no setup() or loop() function. It will not compile. It is incomplete. Therefore, it can't be the "full code".

I posted a new zip file

You’re wasting my time. I’m not gonna download your stupid .zip file. Post your full code in (code tags) or just forget it. I’m about to do just that.

Why do you disrespect the time of people who might be willing to help you? We’re up to 5 posts in this thread and you still haven’t given enough information to even start helping you.

Make it hard for us and we’ll just move on to someone who respects our time and makes it easy to help them.

gfvalvo: You're wasting my time. I'm not gonna download your stupid .zip file. Post your full code in (code tags) or just forget it. I'm about to do just that.

Why do you disrespect the time of people who might be willing to help you? We're up to 5 posts in this thread and you still haven't given enough information to even start helping you.

Make it hard for us and we'll just move on to someone who respects our time and makes it easy to help them.

jeez I'm sorry, but you have to understand I'm quite new to this forum!

How to ask a programming question. How to use the forum.