Wireless signal bouncing NRF24l01 (not sure if this is the problem NOOB)

This project is using 2 arduino and NRF2401l transmitters to send signal to wireless LED for my brake and signal lights.

I have a transmitter and receiver. When I send a signal through the transmitter by using a pullup switch the signal is sent and the light switches on as I want it to. But when I open the switch and want the signal to be stopped the receiver still works on the signal for 5-10 seconds. Please help. I am very new to this, please ignore any mistakes and guide me because I am stuck.

I have used a 3.3v supply for NRF2401 and 470 ohm resistor for ws2812b Led strip. Everything is working fine except that I receive the signals multiple times, I even check it on serial port.

here is a link for a video where I have showed my problem, it will clearly tell you what the problem is

PLEASE HELP

TRANSMITTER



#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

int DataMsg[1];

RF24 radio(9, 10);

const uint64_t pipe = 0xE14BC8F482LL;

int Button1 = 4;  // ihave 4 5 6 7 as the input pins and will add more as required
int Button2 = 5;
int Button3 = 6;
int Button4 = 8;
int Button5 = 3;
void setup()
{
  //ativa pull-up
  pinMode(Button1, INPUT);
  pinMode(Button2, INPUT);
  pinMode(Button3, INPUT);
  pinMode(Button4, INPUT);
  pinMode(Button5, INPUT);

  Serial.begin(57600);
  Serial.println("NRF24L01 Transmitter");

  radio.begin();
  radio.openWritingPipe(pipe);
}

void loop()
{
  if (digitalRead(Button1) == HIGH) // BRAKE first sequence
  {
    Serial.println("Button 1 pressed");
    DataMsg[0] = 1;
    radio.write(DataMsg, 1);
    delay(300);
  }
  if (digitalRead(Button2) == HIGH)  // Right second sequence
  {
    Serial.println("Button 2 pressed");
    DataMsg[0] = 2;
    radio.write(DataMsg, 1);
    delay(300);
  }
  if (digitalRead(Button3) == HIGH) //Left thrid sequence
  {
    Serial.println("Button 3 pressed");
    DataMsg[0] = 3;
    radio.write(DataMsg, 1);
    delay(300);
  }
  if (digitalRead(Button4) == HIGH)  // hazard fourth sequence
  {
    Serial.println("Button 4 pressed");
    DataMsg[0] = 4;
    radio.write(DataMsg, 1);
    delay(300);
  }
  if (digitalRead(Button5) == HIGH)  //unocupied fifth sequence
  {
    Serial.println("Button 5 pressed");
    DataMsg[0] = 5;
    radio.write(DataMsg, 1);
    delay(300);
  }
}



RECEIVER 

#include "Arduino.h"
#include <FastLED.h>
#include <FastLEDPainter.h>

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"

#define NUM_LEDS 32 //Number of LEDs on the strip
#define LED_PIN 2 //Pin where WS281X LED strip data-line is connected

CRGB leds[NUM_LEDS];

//create one canvas and one brush with global scope
FastLEDPainterCanvas pixelcanvas = FastLEDPainterCanvas(NUM_LEDS); //create canvas, linked to the FastLED library (canvas must be created before the brush)
FastLEDPainterBrush pixelbrush = FastLEDPainterBrush(&pixelcanvas); //crete brush, linked to the canvas to paint to

int DataMgs[1];
RF24 radio(9, 10);
const uint64_t pipe = 0xE14BC8F482LL;
//int Relay1 = 5;  irrelevant

void setup()
{

  //initilize FastLED library
  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);

  Serial.begin(57600);
  Serial.println(" ");
  Serial.println(F("FastLED Painter simple demo"));

  //check if ram allocation of brushes and canvases was successful (painting will not work if unsuccessful, program should still run though)
  //this check is optional but helps to check if something does not work, especially on low ram chips like the Arduino Uno
  if (pixelcanvas.isvalid() == false) Serial.println(F("canvas allocation problem (out of ram, reduce number of pixels)"));
  else  Serial.println(F("canvas allocation ok"));

  if (pixelbrush.isvalid() == false) Serial.println(F("brush allocation problem"));
  else  Serial.println(F("brush allocation ok"));

  //initialize the animation, this is where the magic happens:

  CHSV brushcolor; //the brush and the canvas operate on HSV color space only
  brushcolor.h = 000; //zero is red in HSV. Library uses 0-255 instead of 0-360 for colors (see https://en.wikipedia.org/wiki/HSL_and_HSV)
  brushcolor.s = 255; //full color saturation
  brushcolor.v = 255; //about half the full brightness

  pixelbrush.setSpeed(550); //set the brush movement speed (4096 means to move one pixel per update)
  pixelbrush.setColor(brushcolor); //set the brush color
  pixelbrush.setFadeSpeed(200); //fading speed of pixels (255 is maximum fading speed)
  pixelbrush.setFadeout(true); //do brightness fadeout after painting
  pixelbrush.setBounce(true); //bounce the brush when it reaches the end of the strip

  //this sets up the brush to paint pixels in red, the pixels fade out after they are painted (the brush is the size of one pixel and can only one pixel per brush update, see other examples to paint multiple pixels at once)




  //pinMode(Relay1, OUTPUT); irrelevant
  //Serial.begin(57600);
  radio.begin();
  radio.openReadingPipe(1, pipe);
  radio.startListening();
}

void loop()
{
  radio.read(DataMgs, 1);
  // DataMsg = 0;
  //if (radio.available())
  {
    bool done = false;
    while (!done)
    {
      //done = radio.read(DataMgs, 1);
      radio.read(DataMgs, 1);
      //Serial.print("NRF24L01 Receiver: ");
      Serial.println(DataMgs[0]);

      if (DataMgs[0] == 0) // knight rider default sequence
      {
        FastLED.setBrightness(250);
        int e;
        for (int e = 0; e <= 200; e++) {
          FastLED.clear(); //always need to clear the pixels, the canvas' colors will be added to whatever is on the pixels before calling a canvas update

          pixelbrush.paint(); //paint the brush to the canvas (and update the brush, i.e. move it a little)
          pixelcanvas.transfer(); //transfer the canvas to the LEDs
          FastLED.show();
          delay(1);
        }

        //delay(10);
        //digitalWrite(Relay1, HIGH);
      }

      if (DataMgs[0] == 1) // Brake first sequence
      {
        FastLED.setBrightness(250);
        for (int i = 0; i <= 31; i++) {
          leds[i] = CRGB ( 255, 0, 0);
          FastLED.show();
        }
        delay(200);

        for (int i = 0; i <= 31; i++) {
          leds[i] = CRGB ( 0, 0, 0);
          FastLED.show();
        }
        delay(200);
        //delay(10);
        //digitalWrite(Relay1, HIGH);
      }

      if (DataMgs[0] == 2) // Right second sequence
      {
        FastLED.setBrightness(250);
        for (int i = 16; i <= 31; i++) {
          leds[i] = CRGB ( 255, 160, 0);
          FastLED.show();
          delay(30);
        }
        //delay(50);
        for (int i = 16; i <= 31; i++) {
          leds[i] = CRGB ( 0, 0, 0);
          FastLED.show();
          delay(10);
        }
        //delay(10);digitalWrite(Relay1, LOW);
      }
      if (DataMgs[0] == 3) // Left thrid sequence
      {
        FastLED.setBrightness(250);
        for (int i = 15; i >= 0; i--) {
          leds[i] = CRGB ( 255, 160, 0);
          FastLED.show();
          delay(30);
        }
        //delay(50);
        for (int i = 15; i >= 0; i--) {
          leds[i] = CRGB ( 0, 0, 0);
          FastLED.show();
          delay(10);
        }
        //delay(10);
        //digitalWrite(Relay1, HIGH);
      }
      if (DataMgs[0] == 4) // hazard fourth sequence
      {
        FastLED.clear();
        delay(300);
        FastLED.setBrightness(250);

        for (int i = 0; i <= 12; i++) {
          leds[i] = CRGB ( 255, 160, 0);
          FastLED.show();
        }
        for (int i = 19; i <= 31; i++) {
          leds[i] = CRGB ( 255, 160, 0);
          FastLED.show();
        }
        delay(400);
        for (int i = 0; i <= 31; i++) {
          leds[i] = CRGB ( 0, 0, 0);
          FastLED.show();
        }
      }
      //if (DataMgs[0] == 5) // unoccupied fifth sequence, template
      {
        //delay(10);
        //digitalWrite(Relay1, HIGH);
      }
      //delay(500);
    }
    // the initial iff}
    //else
    //{
    //Serial.println("Waiting for signal...");
    //delay(1);
    //}
  }
}

Do the button switches on the transmitter have pull down resistors.

Buttons should be connected between the input and ground. Then use a pull up resistor or enable the internal ones.

It sounds like you are expecting an input with nothing connected to it to be read as a logic low, it is not.

Yes I have connected the inputs with ground and a 10k resistor in between to avoid the floating pin problem. The switches work flawlessly but the problem occurs in wireless transmission. The receiver picks the signal for an additional 10-5 seconds even after I have opened the switch and there is no more signal on the transmission side.

Yes I have connected the inputs with ground and a 10k resistor in between

Can you show the connection in a schematic. The textual description is unclear.

This is how I have connected the switch and other components.

Hussain12:
Yes I have connected the inputs with ground and a 10k resistor in between to avoid the floating pin problem. The switches work flawlessly but the problem occurs in wireless transmission. The receiver picks the signal for an additional 10-5 seconds even after I have opened the switch and there is no more signal on the transmission side.

That's might be because the receiver delays for longer than the transmitter for some of the messages,
so it can get behind?

I'd lose the delays on the receive side if possible to see if this is whats happening.

MarkT:
That's might be because the receiver delays for longer than the transmitter for some of the messages,
so it can get behind?

I'd lose the delays on the receive side if possible to see if this is whats happening.

Sir tried that too, doesnt help.