<commit_before>#include <Stepper.h>

const int stepsPerRevolution = 200;
const int maxRpm = 150;
const int ledPin = 10;
const int forwardSwitchPin = 12;
const int backwardSwitchPin = 8;
const int maxStepsPerDirection = 500;
Stepper stepper(stepsPerRevolution, 2, 4, 5, 6);
const int driverEnablePin = 3; // 490Hz
// http://homepage.cs.uiowa.edu/~jones/step/current.html
// duty-cycle = 0.49 = (0.6 A * 4.1 ohm) / (9.6 V_supply)
const int driverEnablePinValue = 0.6 * 4.1 / 9.6 * 255;
boolean movingForward = true;
int stepCounter = 0;

void setup() {
  Serial.begin(9600);
  pinMode(driverEnablePin, OUTPUT);
  pinMode(forwardSwitchPin, INPUT);
  pinMode(backwardSwitchPin, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(driverEnablePin, LOW);
  digitalWrite(LED_BUILTIN, LOW);
}

void playNote(int frequency, int duration) {
  float revolutionsPerMinute = frequency * 60.0 / stepsPerRevolution;
  float steps = 1.0 * frequency * duration / 1000.0;

  Serial.print("Freq: ");
  Serial.println(frequency);
  Serial.print("Dur: ");
  Serial.println(duration);
  Serial.print("RPM: ");
  Serial.println(revolutionsPerMinute);
  Serial.print("Steps: ");
  Serial.println(steps);

  if (revolutionsPerMinute > maxRpm) {
    Serial.println("Max RPM exceeded.");
    Serial.println();
    return;
  }

  Serial.println();

  stepper.setSpeed(revolutionsPerMinute);
  analogWrite(ledPin, map(revolutionsPerMinute, 1, maxRpm, 0, 255));

  analogWrite(driverEnablePin, driverEnablePinValue);

  int stepsLeft = steps;

  while (stepsLeft) {
    int stepsInThisLoop = min(stepsLeft, maxStepsPerDirection - stepCounter);

    if (movingForward) {
      stepper.step(stepsInThisLoop);
    }
    else {
      stepper.step(-stepsInThisLoop);
    }<commit_msg>scanner_stepper.ino: Reduces amount printed in output.<commit_after>#include <Stepper.h>

const int stepsPerRevolution = 200;
const int maxRpm = 150;
const int ledPin = 10;
const int forwardSwitchPin = 12;
const int backwardSwitchPin = 8;
const int maxStepsPerDirection = 500;
Stepper stepper(stepsPerRevolution, 2, 4, 5, 6);
const int driverEnablePin = 3; // 490Hz
// http://homepage.cs.uiowa.edu/~jones/step/current.html
// duty-cycle = 0.49 = (0.6 A * 4.1 ohm) / (9.6 V_supply)
const int driverEnablePinValue = 0.6 * 4.1 / 9.6 * 255;
boolean movingForward = true;
int stepCounter = 0;

void setup() {
  Serial.begin(9600);
  pinMode(driverEnablePin, OUTPUT);
  pinMode(forwardSwitchPin, INPUT);
  pinMode(backwardSwitchPin, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(driverEnablePin, LOW);
  digitalWrite(LED_BUILTIN, LOW);
}

void playNote(int frequency, int duration) {
  float revolutionsPerMinute = frequency * 60.0 / stepsPerRevolution;
  float steps = 1.0 * frequency * duration / 1000.0;

  Serial.print("F: ");
  Serial.println(frequency);
  Serial.print("T: ");
  Serial.println(duration);
  Serial.print("RPM: ");
  Serial.println((int) revolutionsPerMinute);
  Serial.print("s: ");
  Serial.println((int) steps);

  if (revolutionsPerMinute > maxRpm) {
    Serial.println("Max RPM exceeded.");
    Serial.println();
    return;
  }

  Serial.println();

  stepper.setSpeed(revolutionsPerMinute);
  analogWrite(ledPin, map(revolutionsPerMinute, 1, maxRpm, 0, 255));

  analogWrite(driverEnablePin, driverEnablePinValue);

  int stepsLeft = steps;

  while (stepsLeft) {
    int stepsInThisLoop = min(stepsLeft, maxStepsPerDirection - stepCounter);

    if (movingForward) {
      stepper.step(stepsInThisLoop);
    }
    else {
      stepper.step(-stepsInThisLoop);
    }
{'fraction_non_alphanumeric': 0.13020544142143253, 'fraction_numerical': 0.03331482509716824, 'mean_word_length': 4.329881656804734, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1669421', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1236, 'n_words': 273}