Browse Source

added a way to tone down the plot spam

main
rra 4 years ago
parent
commit
ee16f406e4
  1. 18
      pointlights.ino

18
pointlights.ino

@ -8,13 +8,13 @@ unsigned long currentMillis;
int brightness = 0; // our main variable for setting the brightness of the LED int brightness = 0; // our main variable for setting the brightness of the LED
float velocity = 1.0; // the speed at which we change the brightness. float velocity = 1.0; // the speed at which we change the brightness.
int ledPin = 9; // we use pin 9 for PWM int ledPin = 9; // we use pin 9 for PWM
int p = 0; // use to keep track how often we plot
int plotFrequency = 3; // how often we plot, every Nth time.
void setup() { void setup() {
// put your setup code here, to run once: // put your setup code here, to run once:
pinMode(ledPin, OUTPUT); // set ledPin as an output. pinMode(ledPin, OUTPUT); // set ledPin as an output.
Serial.begin(9600); // initiate the Serial monitor so we can use the Serial Plotter to graph our patterns Serial.begin(9600); // initiate the Serial monitor so we can use the Serial Plotter to graph our patterns
} }
void loop() { void loop() {
@ -90,11 +90,15 @@ void changeState(ledStates newState){
void plot(char *state, int brightness){ void plot(char *state, int brightness){
// use this function to plot a graph. // use this function to plot a graph.
// it will normalize the auto-scaling plotter // it will normalize the auto-scaling plotter
Serial.print(state);
Serial.print(", "); if ((p % plotFrequency) == 0){
Serial.print(brightness); Serial.print(state);
Serial.println(", 0, 300"); Serial.print(", ");
Serial.print(brightness);
Serial.println(", 0, 300");
}
p++;
} }
int increase_brightness (int brightness, float velocity){ int increase_brightness (int brightness, float velocity){

Loading…
Cancel
Save