<commit_before>#include "Configuration.h"
#include <DifferentialStepper.h>
#include <Bot.h>
#include <Servo.h>

Bot bot(MOTOR_L_PIN_1, MOTOR_L_PIN_2, MOTOR_L_PIN_3, MOTOR_L_PIN_4, MOTOR_R_PIN_1, MOTOR_R_PIN_2, MOTOR_R_PIN_3, MOTOR_R_PIN_4);

void setup()
{
  Serial.begin(9600);
  Serial.println("Logobot");
  bot.begin();
  bot.initBumpers(SWITCH_FL_PIN, SWITCH_FR_PIN, SWITCH_BL_PIN, SWITCH_BR_PIN, handleCollision);
  bot.initBuzzer(BUZZER_PIN);
  //bot.lookAheadEnable(true);
  bot.playStartupJingle();
}

void loop()
{

  // keep the bot moving (this triggers the stepper motors to move, so needs to be called frequently, i.e. >1KHz)
  //bot.run();

  // check sensor value, report on Serial
  delay(500);
  Serial.println(digitalRead(IR_LEFT_PIN));
}

static void handleCollision(byte collisionData)
{
	if (collisionData != 0) {
		// Just hit something, so stop and buzz
		bot.emergencyStop();  // this will be called by parseLogoCommand
		bot.buzz(500);
	}

	// Insert some recovery based on which bumper was hit
	bot.drive(-20);
	if (collisionData == 1) {
        bot.turn(-30);
	} else if (collisionData == 2) {
        bot.turn(60);
	} else {
        bot.turn(-90);
	}
}
<commit_msg>vaguely workable line follower<commit_after>#include "Configuration.h"
#include <DifferentialStepper.h>

// differntial stepper drive
DifferentialStepper diffDrive(
    DifferentialStepper::HALF4WIRE,
    MOTOR_L_PIN_1, MOTOR_L_PIN_2, MOTOR_L_PIN_3, MOTOR_L_PIN_4,
    MOTOR_R_PIN_1, MOTOR_R_PIN_2, MOTOR_R_PIN_3, MOTOR_R_PIN_4
);

int nextLeft, nextRight;

void setup()
{
  Serial.begin(9600);
  Serial.println("Logobot Line Follower");

  diffDrive.setMaxStepRate(1000);
  diffDrive.setAcceleration(2000);
  diffDrive.setBacklash(STEPS_OF_BACKLASH);
  diffDrive.setInvertDirectionFor(0,true);

  nextLeft = 5;
  nextRight = 5;
}

void loop()
{

  diffDrive.run();

  // check sensors
  if (!digitalRead(IR_LEFT_PIN)) {
      nextLeft = 1;
  }
  if (!digitalRead(IR_RIGHT_PIN)) {
      nextRight = 1;
  }

  if (diffDrive.isQEmpty()) {
      // decide what to do next
      diffDrive.queueMove(nextLeft, nextRight);

      // reset next
      nextLeft = 5;
      nextRight = 5;
  }
}

{'fraction_non_alphanumeric': 0.12350780532598714, 'fraction_numerical': 0.02662993572084481, 'mean_word_length': 3.9977064220183487, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3833389', 'n_tokens_mistral': 918, 'n_tokens_neox': 837, 'n_words': 169}