<commit_before>int photoRPin = 0; 
int minLight;
int maxLight;
int lightAmt;
int percentageLightLevel;

void setup() {
 Serial.begin(9600);
 
 //Setup the starting light level limits
 lightAmt=analogRead(photoRPin);
 minLight=lightAmt-20;
 maxLight=lightAmt;
}

void loop(){
 //auto-adjust the minimum and maximum limits in real time
 lightLevel=analogRead(photoRPin);
 if(minLight>lightAmt){
 minLight=lightAmt;
 }
 if(maxLight<lightAmt){
 maxLight=lightAmt;
 }
 
 //Adjust the light level to produce a result between 0 and 100.
 percentageLightLevel = map(lightAmt, minLight, maxLight, 0, 100); 
 
 //Send the adjusted Light level result to Serial port (processing)
 Serial.println(percentageLightLevel);
 
 //slow down the transmission for effective Serial communication.
 delay(50);
}<commit_msg>Light sensor sketch has been more or less finalized.<commit_after>/*   ---------------
 *   lightSensor.ino
 *   ---------------
 * 
 *   
 *   <NAME>
 *
 *   This file reads data from a photoresistor connected to an Arduino
 *   and prints it to the serial port. 
 *
 *   Slightly modified from http://arduinobasics.blogspot.com/2011/06/arduino-uno-photocell-sensing-light.html
 * 
 *   Happy Arduino-ing! 
 */


// Initialize relevant variables
int photoRPin = 0; 
int minLight;
int maxLight;
int lightAmt;
int percentageLightLevel;

void setup() {
  
  Serial.begin(9600);
  
  // Set relevant variables
  lightAmt=analogRead(photoRPin);
  minLight=lightAmt-20;
  maxLight=lightAmt;
  
} // END setup

void loop(){
  
  // manage the mins and maxes
  lightAmt=analogRead(photoRPin);
  
  if( minLight >= lightAmt-1 ){
    minLight=lightAmt;
  } // END if
  
  if( maxLight <= lightAmt-1 ){
    maxLight=lightAmt;
  } // END if
  
  // Convert to a percentage
  percentageLightLevel = map(lightAmt, minLight, maxLight, 0, 100); 
  
  // Send the stuff to the serial port
  Serial.println(percentageLightLevel);
  
  // add a bit of a delay
  delay(50);
  
} // END void loop()


{'fraction_non_alphanumeric': 0.11767676767676767, 'fraction_numerical': 0.01919191919191919, 'mean_word_length': 3.2786177105831533, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '4881235', 'n_tokens_mistral': 693, 'n_tokens_neox': 643, 'n_words': 185}