I have a radio receiver wired up with an LED array (32 x 15) and am trying to define the animation that is displayed on the LED array based off of what the radio receiver...receives. The problem right now though is that the VirtualWire library is never receiving a message in the main program. But, in the test program (same wiring and everything) I receive all the messages just fine.
The test program that receives everything and which works correctly is here:
#include <VirtualWire.h>
//Pin to receive data from the radio receiver
const byte receivePin = 4;
void setup() {
//set pins to output because they are addressed in the main loop
Serial.begin(9600);
Serial.println("*");
vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(receivePin);
vw_setup(2000);// Bits per sec
vw_rx_start();// Start the receiver PLL running
}
void loop() {
byte buf[VW_MAX_MESSAGE_LEN];
byte buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) { // Non-blocking
Serial.println("RECEIVE");
for (int i = 0; i < buflen; i++) {
char asciiChar = buf[i];
Serial.print(asciiChar);
}
Serial.println();
}
}
The program that I have that is not receiving anything is attached (slightly too big to post, 672 lines) and the function that is supposed to read the message(s) starts on line 444. In this program you see that I Serial.println() and I always get the message "checking for a message" in my console but I never get "got a message" in the attached program.
Could this be a memory issue? I did try to comment out the largest of my boolean arrays but it didn't help at all. The animations play perfectly fine in the LED board always, but I just can't receive a radio message.
Backpack.ino (64.4 KB)