#include < Arduino.h >
// Pin Definitions
#define TCRT5000_SENSOR A0 // Analog input for TCRT5000 sensor
#define LEFT_MOTOR_IN1 5 // Left motor control pin 1
#define LEFT_MOTOR_IN2 6 // Left motor control pin 2
#define RIGHT_MOTOR_IN1 9 // Right motor control pin 1
#define RIGHT_MOTOR_IN2 10 // Right motor control pin 2
#define LEFT_MOTOR_PWM 3 // Left motor speed control
#define RIGHT_MOTOR_PWM 11 // Right motor speed control
// TCRT5000 Sensor Calibration Parameters
#define SENSOR_THRESHOLD 500 // Analog threshold between black and white
#define CALIBRATION_ITERATIONS 100
// Motor Control Variables
int baseSpeed = 180; // Base motor speed
int turnSpeed = 200; // Speed during turns
int correctionFactor = 50; // Speed difference for course correction
// Sensor Calibration Variables
int minSensorValue = 1023;