Hello Shawn,
Thank you for your work on this library.
I was playing with your v4.1.0-beta trying to get Transmit and Receive to work simultaneously.
I want to 'intercept' DMX: receive some DMX, change some values, then send it back on its way.
I am using a Teensy 4.
To debug this issue, I'm directly connecting the Tx pin of the transmitter to the Rx pin of the receiver, on the Teensy 4.
- Tx: Serial2 so TX2 pin 8
- Rx: Serial1 so RX1 pin 0
I have wired these pins directly together, not via a pair of RS485 transceivers, to help debug.
I have also setup a logic analyser with DMX protocol decoder to monitor the signal.
Code:
#include <TeensyDMX.h>
namespace teensydmx = ::qindesign::teensydmx;
teensydmx::Receiver dmxRx{Serial1};
teensydmx::Sender dmxTx{Serial2};
// Example 1
// uint8_t lastValue = 0;
void setup() {
dmxRx.begin();
// DEBUGING
Serial3.begin(115200);
dmxTx.begin();
for (uint8_t i=0; i<128;++i){
dmxTx.set(i, 0);
}
dmxTx.set(1, 10);
}
void loop() {
// This will return zero for no data (and also for data that's zero)
/*uint8_t v = dmxRx.get(1);
if (v != lastValue) {
lastValue = v;
Serial3.println(v, DEC);
}*/
}
The problem is, as is the Sender doesn't generate any DMX signal if the code is like above. Constant 0V output.
But if I comment out
The DMX is correctly output.
Do you know of any working reference code that does can receive then send 'simultaneously'?
Thanks again