<commit_before>/***********************************************************************
 * Description: Counteracts a change in angle by reading a gyro sensor *
 * and rotating a stepper motor. Accepts correction factors via serial *
 * at 115200 baud.                                                     *
 * Project: Eclipse Tracking (2017)                                    *
 * @Version 4.0 (5/27/2017)                                            *
 * @Author <NAME> / <NAME> / <NAME>                     *
 ***********************************************************************/
#include <Stepper.h>
#include <Wire.h>
#include <MsTimer2.h>
#include <SparkFunLSM9DS1.h>
#include "config.h"

// ================ SYSTEM PARAMETERS ===================
// Sample rates
int motorUpdateRate = 50; // gyro sample rate
int calibrationSamples = 500;

// Initial calibration value
float calibratedOffset = 0;

// Indicator LED
const int LED = 13;

const byte GEAR_RATIO = 1; // servo gear : slip gear

// ============ Initialize electronic interfaces =========
LSM9DS1 imu;

int stepperPins[] = {9, 10, 11, 12};
int numSteps = 200;
float stepSize = 9.0 / 5.0;

Stepper azimuth(numSteps, stepperPins[0], stepperPins[1], stepperPins[2], stepperPins[3]);
// ============ Runtime variables ========================
// Orientation data
float positionChange;

// Interrupt flag
int timer = millis();
bool update_flag = false; // interrupt flag for executing motor update

/**
    Sets up system
*/
void setup() {
  // Initialize I/O
  Serial.begin(115200);
  pinMode(LED, OUTPUT);

  for (int i = 0; i < 4; i++) {
    pinMode(stepperPins[i], OUTPUT);
  }

  // Setup hardware
  setupIMU(); // Gyro

  // Calibrate the gyro
  calibratedOffset = zeroGyro(calibrationSamples);

  // Setup motor update interval timer
  MsTimer2::set(motorUpdateRate, updateMotor);
  MsTimer2::start();<commit_msg>Set Speed of stepper motor in RPM.<commit_after>/***********************************************************************
 * Description: Counteracts a change in angle by reading a gyro sensor *
 * and rotating a stepper motor. Accepts correction factors via serial *
 * at 115200 baud.                                                     *
 * Project: Eclipse Tracking (2017)                                    *
 * @Version 4.0 (5/27/2017)                                            *
 * @Author <NAME> / <NAME> / <NAME>                     *
 ***********************************************************************/
#include <Stepper.h>
#include <Wire.h>
#include <MsTimer2.h>
#include <SparkFunLSM9DS1.h>
#include "config.h"

// ================ SYSTEM PARAMETERS ===================
// Sample rates
int motorUpdateRate = 50; // gyro sample rate
int calibrationSamples = 500;

// Initial calibration value
float calibratedOffset = 0;

// Indicator LED
const int LED = 13;

const byte GEAR_RATIO = 1; // servo gear : slip gear

// ============ Initialize electronic interfaces =========
LSM9DS1 imu;

int stepperPins[] = {9, 10, 11, 12};
int numSteps = 200;
int stepperRPM = 20;
float stepSize = 9.0 / 5.0;

Stepper azimuth(numSteps, stepperPins[0], stepperPins[1], stepperPins[2], stepperPins[3]);
azimuth.setSpeed(stepperRPM);
// ============ Runtime variables ========================
// Orientation data
float positionChange;

// Interrupt flag
int timer = millis();
bool update_flag = false; // interrupt flag for executing motor update

/**
    Sets up system
*/
void setup() {
  // Initialize I/O
  Serial.begin(115200);
  pinMode(LED, OUTPUT);

  for (int i = 0; i < 4; i++) {
    pinMode(stepperPins[i], OUTPUT);
  }

  // Setup hardware
  setupIMU(); // Gyro

  // Calibrate the gyro
  calibratedOffset = zeroGyro(calibrationSamples);

  // Setup motor update interval timer
  MsTimer2::set(motorUpdateRate, updateMotor);
  MsTimer2::start();
{'fraction_non_alphanumeric': 0.22340980187695517, 'fraction_numerical': 0.03232533889468196, 'mean_word_length': 3.0220125786163523, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '671745', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1067, 'n_words': 327}