Skip to content

Instantly share code, notes, and snippets.

@pinglunliao
Created March 23, 2018 09:14
Show Gist options
  • Save pinglunliao/cff5d5e420abea6c087f168d9bc3c214 to your computer and use it in GitHub Desktop.
Save pinglunliao/cff5d5e420abea6c087f168d9bc3c214 to your computer and use it in GitHub Desktop.
Arduino Serial Plotter Example
#include "Math.h"
void setup() {
Serial.begin(9600);
}
void loop() {
float angle = 0;
float sineData;
float cosineData;
float sum;
for(angle = 0.0; angle <= 90; angle += 0.1) {
sineData = sin(angle);
cosineData = cos(angle);
sum = sineData + cosineData;
Serial.print(sineData);
Serial.print(" ");
Serial.print(cosineData);
Serial.print(" ");
Serial.print(sum);
Serial.println();
delay(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment