I am currently at my wits end trying to make this work, I suppose my understanding of how Teensy handles HardwareSerial may be an issue with the code I am trying to write.
The original idea for this mini-project (a first step in a much larger endeavor), was to set my Teensy to a Raw HID mode, allow communication from a connected computer, and use the TeensyDMX library to talk to a simple DMX controlled light I am using to test my code. With the XLR ground connected to ground, Data+ connected to pin 1, and Data- connected to pin 2, I am successful at getting my light to turn red, or any other color I choose to initialize with.
However, any call to delay() is simply ignored by the program, and seems to halt. This is understandable, as the Serial libraries that TeensyDMX is built upon probably uses interrupts (I could be wrong here too, I make a lot of assumptions about the things I am working with), which can interfere destructively with a delay() call. I had some success using IntervalTimers to control the output of some of the channels, and that's as far as I got. I switched back from Raw HID to plain serial communication under the assumption that the library might be out of date, but I cannot seem to be able to communicate with my computer in any meaningful way with Serial as well. As soon as the connection with the light is established, no data can be sent to my computer using Serial.println(), Serial.write() or anything else. Is it the case that the Serial ports used by TeensyDMX "hog" up the USB Serial connection to my laptop, or am I experiencing one of many brain-dead moments where the answer is quite obvious but I keep ramming my head into the wall trying to accomplish something that is functionally impossible with the code I am trying to write?
I have scoured the forums trying to find anyone who has been in my position but I cannot seem to find anything. I appreciate those who can come to my assistance.
Here is my (very basic) test code for the communication/lighting duo I am trying to accomplish.
The original idea for this mini-project (a first step in a much larger endeavor), was to set my Teensy to a Raw HID mode, allow communication from a connected computer, and use the TeensyDMX library to talk to a simple DMX controlled light I am using to test my code. With the XLR ground connected to ground, Data+ connected to pin 1, and Data- connected to pin 2, I am successful at getting my light to turn red, or any other color I choose to initialize with.
However, any call to delay() is simply ignored by the program, and seems to halt. This is understandable, as the Serial libraries that TeensyDMX is built upon probably uses interrupts (I could be wrong here too, I make a lot of assumptions about the things I am working with), which can interfere destructively with a delay() call. I had some success using IntervalTimers to control the output of some of the channels, and that's as far as I got. I switched back from Raw HID to plain serial communication under the assumption that the library might be out of date, but I cannot seem to be able to communicate with my computer in any meaningful way with Serial as well. As soon as the connection with the light is established, no data can be sent to my computer using Serial.println(), Serial.write() or anything else. Is it the case that the Serial ports used by TeensyDMX "hog" up the USB Serial connection to my laptop, or am I experiencing one of many brain-dead moments where the answer is quite obvious but I keep ramming my head into the wall trying to accomplish something that is functionally impossible with the code I am trying to write?
I have scoured the forums trying to find anyone who has been in my position but I cannot seem to find anything. I appreciate those who can come to my assistance.
Here is my (very basic) test code for the communication/lighting duo I am trying to accomplish.
Code:
#include <TeensyDMX.h>
namespace teensydmx = ::qindesign::teensydmx;
teensydmx::Sender Univ_1{Serial1};
/**Ignore the extra universes, I'm saving these for later**/
//teensydmx::Sender Univ_2{Serial1};
//teensydmx::Sender Univ_3{Serial2};
//teensydmx::Sender Univ_4{Serial3};
byte buffer[64];
void setup() {
Serial.begin(9600);
Univ_1.begin();
Univ_1.set(1, 255);
Univ_1.set(2, 255);
}
void loop(){
Serial.println(1);
}