-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Added functionality to plot multiple signals at the same time #4022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you @henningpohl. I would ask you a modification: instead of hardcoding colours in theme.txt, how about specifying them in the sketch? Syntax would then become something like
This makes using the plotter easier as user has full control on which and how many colours to use. It would be even better if colours were optional: when missing, use default colour |
This way you could also display multiple channels. Which I would really like for my music visualization debugging. |
But if we wanted to use "Serial Monitor" instead "Serial Plotter", data would be shown a bit (I don't know how to say it) verbose/recharged/cluttered, wouldn't? |
The alternative is to locate an almost hidden file in IDE installation folder, being sure user can edit it (on windows it may not be possible, especially in schools/colleges), restart the ide and reopen the serial plotter #define PLOTTER 1
#if PLOTTER == 1
void printSensorReadings() {
Serial.print(sensorOneReading);
Serial.print(" FF0000,");
Serial.print(sensorTwoReading);
Serial.print(" 00FF00,");
Serial.print(sensorThreeReading);
Serial.print(" 0000FF");
Serial.println();
}
#else
void printSensorReadings() {
Serial.print(sensorOneReading);
Serial.print(",");
Serial.print(sensorTwoReading);
Serial.print(",");
Serial.print(sensorThreeReading);
Serial.println();
}
#endif |
Hmm... my personal take is that I would avoid putting any command codes into the serial stream from the Arduino. Several reasons:
I think a nicer way to allow changing this in a sketch would be to have annotations in a sketch to be extracted by the IDE, but not compiled into the program to run on the Arduino. In a way this is similar to issues arduino/arduino-ide#2438 and #3228: we'd like the IDE to pick up on settings related to a specific sketch. One way to do this would be to abuse #pragmas. For example, the header of a sketch could read something like:
|
@henningpohl is right. Speed matter much and if I think (especially) on mz music visualization, I need this time. In any case his solution makes more sense. Or just have no different colors, then it is like that. Thats the limitation. |
I'll chime in to say that I also think it's a bad idea to specify the colors in the serial data itself. For instance, someone may want to switch back and forth between plotting the data and sending it to an application; having the colors in the serial stream will confuse / complicate that other application. Anyway, this is just a debugging visualization, not a final / end-user interface, so I don't think we need to provide that kind of customization. |
Also, can we split on tabs as well as spaces (if this doesn't already do so)? I use them in my code and I've definitely seen others do the same. |
If I can say what I think, the feature is really cool!!! I can agree about the fact that printing the color in the Serial monitor can be confusing for the datas, but however I think that putting some label is better. If i write some data on the serial monitor I always print variableName: variableValue. In this way you cannot understand one thing for another. You can use something like: Serial.print("i:"); To have a legend in the serial monitor. If you don't put anything you don't have the legend. What do you think about this? |
Sorry for the wrong reference, a mistake in the copy and paste |
@agdl what about opening a separate issue for this improvement request? |
If you agree, we can merge this PR and discuss how to further improve the plotter in a dedicate issue |
Would it be possible to ask @ArduinoBot to build this so I can try it out? There was some discussion of this on the Arduino forum. The suggestion we came up with is demonstrated in this sketch: http://forum.arduino.cc/index.php?topic=357788.msg2468220#msg2468220. |
@ArduinoBot build this please |
@henningpohl I'm going to merge this PR (and thank you again). As you see, it's gaining much interest from the community. Should any of the proposed new features make sense to you, feel free to propose code or sponsor an open issue |
Added functionality to plot multiple signals at the same time
Instead of plotting only one value, the SerialPlotter with this change can plot any number of values at the same time. The color cycle used for this is specified in theme.txt and can be easily changed to enable custom colors for plots with many values (though that might not look very good or be very usable). This is a feature requested by @q2dg in #2177 and #3451. I tested this on one machine, so it would be great if others can try this a bit. There can sometimes be hickups on startup when malformed strings arrive on the Serial port (incomplete lines).