<commit_before>int xcoordinate = 0;
int ycoordinate = 0;
double baseAngle = 0;
double ArmAngle = 0;
int INPUT_SIZE = 40;

#include <AFMotor.h>

// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #2 (M3 and M4)
AF_Stepper motor(200, 1);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Stepper test!");

  motor.setSpeed(10);  // 10 rpm   
}

void forwardBase(int stepnum)
{
  motor.step(stepnum, FORWARD, SINGLE); 
}

void reverseBase(int stepnum)
{
  motor.step(stepnum, BACKWARD, SINGLE); 
}


void parseSerial()
{

  // Get next command from Serial (add 1 for final 0)
  char input[INPUT_SIZE + 1];
  byte size = Serial.readBytes(input, INPUT_SIZE);
  // Add the final 0 to end the C string
  input[size] = 0;

  // Read each command pair 
  char* command = strtok(input, "&");
  while (command != 0)
  {
    // Split the command in two values
    char* separator = strchr(command, ':');
    if (separator != 0)
    {
      // Actually split the string in 2: replace ':' with 0
      *separator = 0;
      xcoordinate = atoi(command);
      ++separator;
      ycoordinate = atoi(separator);

      // Do something with servoId and position
    }
    // Find the next command in input string
    command = strtok(0, "&");
  }
}

void loop() {
  parseSerial();
  if(xcoordinate > 0)
    forwardBase(xcoordinate);
  else if(xcoordinate < 0)
    reverseBase(abs(xcoordinate));
  xcoordinate = 0;
  ycoordinate = 0;<commit_msg>added support for second motor<commit_after>int xcoordinate = 0;
int ycoordinate = 0;
double baseAngle = 0;
double ArmAngle = 0;
int INPUT_SIZE = 40;

#include <AFMotor.h>

// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #2 (M3 and M4)
AF_Stepper motor(200, 2);
AF_Stepper motor1(48, 1);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Stepper test!");

  motor.setSpeed(20);  // 10 rpm   
  motor1.setSpeed(20);  // 10 rpm   

}

void forwardBase(int stepnum)
{
  motor.step(stepnum, FORWARD, MICROSTEP); 
}

void reverseBase(int stepnum)
{
  motor.step(stepnum, BACKWARD, MICROSTEP); 
}

void forwardLaser(int stepnum)
{
  motor1.step(stepnum, FORWARD, MICROSTEP); 
}

void reverseLaser(int stepnum)
{
  motor1.step(stepnum, BACKWARD, MICROSTEP); 
}


void parseSerial()
{

  // Get next command from Serial (add 1 for final 0)
  char input[INPUT_SIZE + 1];
  byte size = Serial.readBytes(input, INPUT_SIZE);
  // Add the final 0 to end the C string
  input[size] = 0;

  // Read each command pair 
  char* command = strtok(input, "&");
  while (command != 0)
  {
    // Split the command in two values
    char* separator = strchr(command, ':');
    if (separator != 0)
    {
      // Actually split the string in 2: replace ':' with 0
      *separator = 0;
      xcoordinate = atoi(command);
      ++separator;
      ycoordinate = atoi(separator);

      // Do something with servoId and position
    }
    // Find the next command in input string
    command = strtok(0, "&");
  }
}

void loop() {
  parseSerial();
  if(xcoordinate > 0)
    forwardBase(xcoordinate);
  else if(xcoordinate < 0)
    reverseBase(abs(xcoordinate));
  if(ycoordinate > 0)
    forwardLaser(ycoordinate);
  else if(ycoordinate < 0)
    reverseLaser(abs(ycoordinate));
  xcoordinate = 0;
  ycoordinate = 0;
{'fraction_non_alphanumeric': 0.12374779021803183, 'fraction_numerical': 0.02975839717147908, 'mean_word_length': 3.0952955367913146, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '3843601', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1138, 'n_words': 352}