Browse Source

added a way to tone down the plot spam

main
rra 5 months ago
parent
commit
ee16f406e4
1 changed files with 11 additions and 7 deletions
  1. +11
    -7
      pointlights.ino

+ 11
- 7
pointlights.ino View File

@ -8,13 +8,13 @@ unsigned long currentMillis;
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.
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() {
// put your setup code here, to run once:
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
}
void loop() {
@ -90,11 +90,15 @@ void changeState(ledStates newState){
void plot(char *state, int brightness){
// use this function to plot a graph.
// it will normalize the auto-scaling plotter
Serial.print(state);
Serial.print(", ");
Serial.print(brightness);
Serial.println(", 0, 300");
// it will normalize the auto-scaling plotter
if ((p % plotFrequency) == 0){
Serial.print(state);
Serial.print(", ");
Serial.print(brightness);
Serial.println(", 0, 300");
}
p++;
}
int increase_brightness (int brightness, float velocity){


Loading…
Cancel
Save