//Source: https://www.woolseyworkshop.com/2019/05/03/using-the-arduino-serial-plotter-to-visualize-real-time-data/#:~:text=Open%20the%20Serial%20Plotter%20window,Plotter%20window%20as%20shown%20below.
void setup() {
   Serial.begin(9600);  // initialize serial bus (Serial Plotter)
}

void loop() {
   // Uncomment one of the wave types below to display in Serial Plotter.
   // Serial Plotter window may need to be closed and reopened between runs
   // to remove old plot data.
   // plotCombinedWaves();
   // plotSawtoothWave();
   // plotSineWave();
   // plotSquareWave();
    plotTriangleWave();
}

void plotCombinedWaves() {
   for (float i = 0.0; i <= 2 * PI; i += 0.1) {
      Serial.print(cos(i));  Serial.print(" ");  // cosine wave
      Serial.print(sin(i));  Serial.print(" ");  // sine wave
      Serial.println(i <= PI ? -1.5 : 1.5);      // square wave
   }
}

void plotSawtoothWave() {
   for (int i = 0; i <= 100; i++) {
      Serial.println(i);
   }
}

void plotSineWave() {
   for (float i = 0.0; i <= 2 * PI; i += 0.1) {
      Serial.println(sin(i));
   }
}

void plotSquareWave() {
   for (int i = 0; i <= 100; i++) {
      Serial.println(0);
   }
   for (int i = 0; i <= 100; i++) {
      Serial.println(100);
   }
}

void plotTriangleWave() {
   for (int i = 0; i <= 100; i++) {
      Serial.println(i);
   }
   for (int i = 100; i >= 0; i--) {
      Serial.println(i);
   }
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
Arduino Code Sharing - Embedded Project