Sorry, I realise I have been a poor poster. I'm not sure how to do a schematic but I'll work on it and get back to this topic. As for the code, I have tried to isolate the issue by using a very simple lighting pattern in the following code. Hope it helps explain what I'm trying to do.
/* Test to try and isolate problems when using 433mhz manchester encoded signal to
control which pattern is sent to WS2812B addressable LEDs*/
#include "Adafruit_NeoPixel.h"
#include "WS2812_Definitions.h"
#include <Manchester.h>
/*
From the manchester example code - I am using 1200 rate.
Manchester Receiver example
In this example receiver will receive one 16 bit number per transmittion
try different speeds using this constants, your maximum possible speed will
depend on various factors like transmitter type, distance, microcontroller speed, ...
MAN_300 0
MAN_600 1
MAN_1200 2
MAN_2400 3
MAN_4800 4
MAN_9600 5
MAN_19200 6
MAN_38400 7
*/
#define RX_PIN 3 //is the data pin for the receiver
#define LED_PIN 13 //is the onboard LED pin
#define powerPin 4 //will supply 5v to the 433mhz receiver
#define PIN 8 //is the data pin for sending data to the WS2812B LED strip
#define LED_COUNT 42 // is the number of LEDs on the strip
uint8_t moo = 1; //this is the number used to flash the onboard led on and off when manchester code has been successfully received and decoded
int indicatorState; //this stores the 4digit number from the decoded manchester code
// Create an instance of the Adafruit_NeoPixel class called "leds".
// That'll be what we refer to from here on...
Adafruit_NeoPixel leds = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_GRB + NEO_KHZ800);
int i; //for the "for" statement increments
void setup() {
pinMode(LED_PIN, OUTPUT); //sets the onboard led to an output
pinMode(powerPin, OUTPUT); //sets the pin which will supply power to the 433mhz receiver as an output
digitalWrite(powerPin, HIGH);// turns the power on to the pin which will be the 5v supply to the 433mhx receiver
man.setupReceive(RX_PIN, MAN_1200);//sets up the manchester decoding
man.beginReceive(); //start listening for manchester code
Serial.begin(9600);//so I can read the 4 digit number being received and decoded
leds.begin(); // Call this to start up the LED strip.
clearLEDs(); // This function, defined below, turns all LEDs off...
leds.show(); // ...but the LEDs don't actually update until you call this.
}
void loop() {
if (man.receiveComplete()) {
uint16_t m = man.getMessage();//retrieve the decoded value and set m as this value
man.beginReceive(); //start listening for next message right after you retrieve the message
moo = ++moo % 2; //alternate moo between 0 and 1
digitalWrite(LED_PIN, moo); //turn the onboard LED on or off, depending on the value of moo
indicatorState = m; //set indicatorState to the value of the decoded number
Serial.println(indicatorState); //so I can check if the 4 digit number has been received and decoded using the serial monitor
}
if(indicatorState == 7561) { //the 4 digit number being sent is 7561 - needs to be complex to avoid cross-talk
AllRed(); //carry out the AllRed function below
}
else {
clearLEDs(); //turn the LEDs off if indicatorState doesn't equal 7561
}
leds.show(); //The problem statement - if this is turned off, I have no problem turning the onboard LED on and off using the 433mhx tx/rx
}
//code to set all the leds on the strip red
void AllRed()
{
for(i=0; i<LED_COUNT; i++) {
leds.setPixelColor(i, RED); // Set the LEDs red
}
}
// Sets all LEDs to off, but DOES NOT update the display;
// call leds.show() to actually turn them off after this.
void clearLEDs()
{
for (int i=0; i<LED_COUNT; i++)
{
leds.setPixelColor(i, 0);
}
}