<commit_before>#include <Potentiometer.h>

#include <Switch.h>

// have to include libraries referenced within libraries in the sketch as well!
#include <Adafruit_NeoPixel.h>
#include <math.h>
#include <NeoPixel.h>
#include <StandardCplusplus.h>
#include <set>
#include <iterator>


#include <NeoPixelRing.h>

bool seededRand = false;

//button on pin 0, debounce 30 ms
Switch randomButton(0, 30);

// test pot
Potentiometer pot(A0);



/* 
  initialize the ring
    What pin is it on?
    Function to turn on/off a group of indices together - could be handled by NeoPixelLightCluster
    randomAll()
    rainbow()
    spin() - set spin speed - (-100, +100), % of max - needs to operate on the individual light level
    update() - poll and update all lights
  
  Make my "lights" (NeoPixelLight)
    What indices does it control?
    Specify indices 
    brightness()
    blink()
    toggleOnOff()
    setColor()
    
  initialize the switches/buttons 
  initialize pots
  - guess I should just set everything based on the hardware to start
  
  SPIN
  Set up knob to have guarantee it's possible to stop the spin in the center of the knob - maybe with a detent?
  Need to initialize the spin speed knob, pulling the current value. If it's non-center, should probably still start "stopped". Might need to alter the neopixelring constructor to support these inits..

*/

// ring size 24, on pin 7
NeoPixelRing ring(24, 7);
  
void setup() {
  Serial.begin(9600);  
  Serial.println("--- Start Serial Monitor ");
  // stand-in for initialization
  // ring.rainbow();
  ring.demo();
}

void loop() {
  
  //delay(1000);
  //ring.randomize();
  // first, update all inputs - switches, knobs, etc - 
  updateComponents();
  
  // Finally, update the ring itself, which should now have all current state, and will be able to determine if it needs to refresh
  ring.update();

}

void updateComponents() {
  pot.update();
  if (pot.valChangedThisUpdate()) {
    Serial.print("pot changed to: "); Serial.println(pot.getPercentVal());
  }
  // update spin pot - if it has changed, call spin()
  // update light knobs
  // update blink and brightness sliders
  // update switches and other buttons
  
  // update the status of all switches/buttons - might be worth putting them in an array to make it an easy loop
  updateRandomButton();
}

void updateRandomButton() {
   randomButton.update();
   if (randomButton.closedThisUpdate()) {
     // if this is the first time the random button is closed, seed the random number generator with the time the program's been running - will vary from run to run
     if (!seededRand) {
       randomSeed(millis());
       seededRand = true;
     }
     ring.randomize();
   }
}


<commit_msg>potentiometer library<commit_after>#include <Potentiometer.h>

#include <Switch.h>

// have to include libraries referenced within libraries in the sketch as well!
#include <Adafruit_NeoPixel.h>
#include <math.h>
#include <NeoPixel.h>
#include <StandardCplusplus.h>
#include <set>
#include <iterator>


#include <NeoPixelRing.h>

bool seededRand = false;

//button on pin 0, debounce 30 ms
Switch randomButton(0, 30);

// test pot
Potentiometer pot(A0);



/* 
  
  initialize the switches/buttons 
  initialize pots
  - guess I should just set everything based on the hardware to start
  or - start with defaults and then update state once there's a change - might be trickier than it's worth
  
  SPIN
  Set up knob to have guarantee it's possible to stop the spin in the center of the knob - maybe with a detent?
  Need to initialize the spin speed knob, pulling the current value. If it's non-center, should probably still start "stopped". Might need to alter the neopixelring constructor to support these inits..

*/

// ring size 24, on pin 7
NeoPixelRing ring(24, 7);
  
void setup() {
  Serial.begin(9600);  
  Serial.println("--- Start Serial Monitor ");
  // stand-in for initialization
  // ring.rainbow();
  ring.demo();
}

void loop() {
  
  //delay(1000);
  //ring.randomize();
  // first, update all inputs - switches, knobs, etc - 
  updateComponents();
  
  // Finally, update the ring itself, which should now have all current state, and will be able to determine if it needs to refresh
  ring.update();

}

void updateComponents() {
  pot.update();
  if (pot.valChangedThisUpdate()) {
    Serial.print("pot changed to: "); Serial.println(pot.getPercentVal());
  }
  // update spin pot - if it has changed, call spin()
  // update light knobs
  // update blink and brightness sliders
  // update switches and other buttons
  
  // update the status of all switches/buttons - might be worth putting them in an array to make it an easy loop
  updateRandomButton();
}

void updateRandomButton() {
   randomButton.update();
   if (randomButton.closedThisUpdate()) {
     // if this is the first time the random button is closed, seed the random number generator with the time the program's been running - will vary from run to run
     if (!seededRand) {
       randomSeed(millis());
       seededRand = true;
     }
     ring.randomize();
   }
}



{'fraction_non_alphanumeric': 0.09732599292174597, 'fraction_numerical': 0.009437672040896579, 'mean_word_length': 3.2533444816053514, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1871251', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1460, 'n_words': 612}