I have been working on a small project recently. I have a circuit like in the image below:
Hardware Setup Demultiplexer IR Test
As you can see I have 8 IR LEDs, which are driven by an MC14051B Multiplexer/Demultiplexer. My goal is to select each IR led individually and send data over the selected IR LED. None of the other LEDs can send signals. Only one LED at a time can be sending IR codes.
Hardware Setup Single IR Test
Below is the code I used to send the signal using the IR Library over one LED (no demultiplexer was used in this test).
// New function to send 'items' codes which are held in the array 'data'
void sendMulti (const uint8_t& items, const uint32_t* data) {
for (int i = 0; i < 2; i++) {
for (uint8_t itemIndex = 0; itemIndex < items; ++itemIndex) {
irsend.sendNEC(data[itemIndex], 32);
delay(1000);
}
}
delay(5000); //5 second delay between each signal burst
}
void loop () {
static const uint8_t MaxItems = 3;
uint32_t data[MaxItems] = {0x1067E21D,0x106722DD,0x106722DD,0x106722DD,0x106722DD,0x106722DD,0x106722DD,0x10676897,0x10676897,0x10676897,0x10676897,0x10676897,0x10676897,0x10678877,0x10676897,0x1067A857,0x1067A857,0x10678877,0x1067A857};
sendMulti(MaxItems, data);
}
The Single IR Test was a success. However now I want to use the demultiplexer. Any advice or pointers will make me very happy.