I'm making a project that involves a lot of communication to boards. (driving a lot of octoWS2811).
Therefore I'm using the Teensy hardware serial. I was planning to put those into an array and then select which board is being send over in the function as to make it more flexible;
Setting the array;
Example function;
This doesn't seem to work. However, when I would just use things like Serial4.begin(9600); and then call Serial4.write("test"); it does work.
Would anyone have any pointer if there is a correct way to handle this, or is this just not a way that Teensy allows. Thanks in advance!
Therefore I'm using the Teensy hardware serial. I was planning to put those into an array and then select which board is being send over in the function as to make it more flexible;
Setting the array;
Code:
int setPort; // Data-type for correct port-handling
setPort = 4;
serialArray[setPort-1].begin(9600); // RX31 TX32 - Teensy 3.5
setPort = 5;
serialArray[setPort-1].begin(9600); // RX34 TX33 - Teensy 3.5
Example function;
Code:
void SerialHandler::sendDataSnippet(unsigned int _port, int _pixel, int _color, int _value) {
serialArray[_port-1].print(STX);
serialArray[_port-1].print('S');
serialArray[_port-1].print(String(_pixel));
serialArray[_port-1].print(String(_color));
serialArray[_port-1].print(String(_value));
serialArray[_port-1].print(ETX);
}
This doesn't seem to work. However, when I would just use things like Serial4.begin(9600); and then call Serial4.write("test"); it does work.
Would anyone have any pointer if there is a correct way to handle this, or is this just not a way that Teensy allows. Thanks in advance!