The Serial Plotter expects each sample set to be terminated by a newline. In your code you only use Serial.print(), so the output becomes one continuous stream without any record separators.
Try changing the last print statement to:
Serial.println(y3);
instead of:
Serial.print(y3);
You may also find that using tabs ('\t') as separators works better than spaces.
One additional observation: your phase shifts of 45 and 180 are being interpreted as radians, not degrees. If those values are intended to be degrees, they should be converted to radians before being added to the sine argument.
You will also want to "print" a minimum (a static value below your traces' minimum) and a maximum (a static value above your traces' maximum) to keep the graph from auto-adjusting and slewing up and down.
// line plotter using constant minimum and maximum values to keep graph from resizing
const int aMIN = -23;
const int aMAX = 1023;
const int graphoffset = 1000;
unsigned long dTimer, dTimeout = 500;
void setup() {
Serial.begin(1115200);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
int a0r = analogRead(A0), a1r = analogRead(A1);
byte d13r = digitalRead(LED_BUILTIN);
Serial.print(aMIN); // minimum value data point to plot
Serial.print(","); // separator between data points
Serial.print(a0r); // floating value data point
Serial.print(",");
Serial.print(a1r);
Serial.print(",");
Serial.print(d13r * graphoffset); // plot LED_BUILTIN value
Serial.print(",");
Serial.print(aMAX); // maximum value data point to plot
Serial.println(); // CR/LF sends this set of data points to line plotter
if (millis() - dTimer >= dTimeout) { // compare "now" to timeout variable
dTimer = millis(); // reset timer
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // invert digital reading
}
}
It is just initializing variables and it exists since the C language was developed 50+ yrs ago.
Instead of initializing a variable with a constant or another variable, it is initialized by doing a function call.
Seen it a lot with one variable per line.
int a0r = analogRead(A0),
a1r = analogRead(A1);
Also used in for loops with 2 (or more) indices
for (int i = 0; j = strlen(str); i < j; i++, j--)
{
if (str[i] != str[j]) ....
}
Since the statement appears inside the loop() function, I would refer to it as a variable update, in contrast to variable initialization, which is performed only once.