here is my project and my problem. I have 2 transceivers NRF24L01, each one is connected to an arduino Mega 2560. I have a good communication between them and I had no problem transferring data wireless until I decided to attach to the one which is receiver a LED Matrix 7219 which has 4 x 8x8 LED.
I also tested the display first before integration and I can display anything without any problem using MD_Parola scripts. The problem appear after integration. I want my data received, temperature in my case to be displayed. The temperature is received and displayed but just one time and first time. If I reset the Mega2560 again new temperature is received and displayed.
To investigate more I followed messages transfer and I see on serial very clear that 2nd and all next messages are not transmitted. During communication I just unplugged the all cables connected to my Matrix7219 and I observed that all next messages with new temperature are sent and received without any problem. Then I tried to give a different plus power supply but the behavior is the same. What could be?
Here below is my code of receiver having the two devices not well integrated together.
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <VirtualWire.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <printf.h>
// Define hardware type, size, and output pins:
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN 6
#define DATA_PIN 7
#define CS_PIN 8
float OutsideTemp = 0;
bool newmessage = false;
//Global message buffers shared by Serial and Scrolling functions
#define BUF_SIZE 75
char curMessage[BUF_SIZE] = { "" };
RF24 radio(9, 10); // CE, CSN
const uint64_t pipe[2] = {0xE6E8F4F4E1BB, 0xE6E8F4F4E1DD}; //send to LV, receive from LV
// Setup for software SPI:
// #define DATAPIN 2
// #define CLK_PIN 4
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);
//const byte address[6] = "00001";
//We could use up to 32 channels
void setup(){
Serial.begin(9600); //Set the speed to 9600 bauds if you want.
radio.begin();
radio.openReadingPipe(1, pipe[1]);
printf_begin();
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.setChannel(120); //if needed
radio.startListening(); //start radio in receiver mode
// Intialize the object:
myDisplay.begin();
// Set the intensity (brightness) of the display (0-15):
myDisplay.setIntensity(0);
// Clear the display:
myDisplay.displayClear();
}
void loop(){
//radio.startListening();
if (radio.available()){
Serial.println("Radio receive is available");
radio.read(&OutsideTemp,sizeof(OutsideTemp));
Serial.print("TEMPERATURE: "); Serial.println(OutsideTemp);
newmessage = true;
delay(2000);
}
else {
//Serial.println("Check your radio");
Serial.print("NEWtemp: "); Serial.println(OutsideTemp);
}
if (newmessage){
char mydata[20];
String mybuffer = "";
mybuffer = (String)OutsideTemp;
mybuffer.toCharArray(mydata, 20);
strcpy(curMessage, mydata);
if (myDisplay.displayAnimate()) {
Serial.println("The DISPLAY should start");
myDisplay.displayText(curMessage, PA_CENTER, 20, 100, PA_PRINT);
while(!myDisplay.displayAnimate());
myDisplay.displayReset();
newmessage = false;
}
delay(100);
}
}