Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Minor issue sending to Teensy from Serial plotter

  1. #1
    Junior Member
    Join Date
    Aug 2021
    Posts
    2

    Minor issue sending to Teensy from Serial plotter

    All (and especially Paul),

    I sincerely appreciate all the open source materials, we use them all extensively when teaching control. I'd like to contribute, even if just a little, hence this "bug report".

    The serial plotter in the Teensyduino (1.54) release is terrific, and it is great to be able to send parameters back to the Teensy from the monitor and plotter window.

    But, I think there is a small problem sending data back to the Teensy from the serial plotter (using the little send box), if one sets the port to be a "Teensy port". THERE IS NO SUCH PROBLEM WHEN USING THE SERIAL MONITOR, just the plotter. If you switch the port to the one listed in the "Serial ports", and restart the plotter, then you can send data back to the Teensy. But then you have to switch the port back to the Teensy port before uploading a modification.

    On MACs (I've only tested catalina) , one can upload code, switch the port to the serial port, start the plotter, and then switch the port back to a Teensy port. Then one can upload and reupload code, plot and send data, as long as one never closes the plotter window. On windows 10, such a workaround fails, and one has to close the plotter window, switch back to a Teensy port, upload the code, switch back to a serial port and restart the plotter. Forgetting a step can lock up the ports badly enough to require a system restart.

    If you select the port from the list of Teensy ports, and then start the serial MONITOR, then the snippet of code below will print the numbers you type in the serial monitor send window (make sure to set the termination to be NL+CR). But if you use the serial plotter, then the numbers you type in the send window are not received. Close the plot window, switch to the serial Teensy port, start the serial plotter, and then the numbers you type will be plotted. The snippet also prints/plots a linearly increasing value, just so one can confirm that the printing/plotting is working.

    I hope this is of some use, and not just annoying,
    Jacob White


    void setup() {
    Serial.begin(1000000);
    Serial.println(" ");
    while(!Serial) {}
    Serial.println(" ");
    }

    int a = 0;
    float b = 0;

    void loop() {
    String inStr = "";

    Serial.print(a++); Serial.print(", ");
    delay(100);

    while (Serial.available()) {
    char inChar = (char) Serial.read();
    inStr += inChar;
    if (inChar == '\n') { // newline terminates line.
    b = inStr.toFloat();
    inStr = "";
    }
    }
    Serial.println(1000*b);
    }

  2. #2
    Junior Member
    Join Date
    Aug 2021
    Posts
    2
    Apologies, there is a simple workaround,

    If one ALWAYS uses the teensy entry in the list of serial ports, and never the one in the list of Teensy ports, either under windows 10 or Mac catalina, then one can open the plotter, use its send function, and everything works. One can repeatedly redownload without closing the plotting window, no need to change to the Teensy port.

    Not sure if there is a downside to that, sorry for the bother.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •