void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
//plotCombinedWaves();
//plotSawtoothWave();
//plotSquareWave();
plotTriangleWave();
}
void plotCombinedWaves(){
for (float i = 0.0; i<= 2* PI; i += 0.1) {
Serial.print(cos(i)); Serial.print(" "); // cosine wave
Serial.println(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 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);
delay(100);
}
for (int i =100; i >= 0; i--){
Serial.println(i);
delay(100);
}
}