diff --git a/src/main.cpp b/src/main.cpp index f47eefc..c93b0be 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,7 +35,7 @@ OmniWheelMotors motors(MOTOR1_R_PWM, MOTOR1_L_PWM, int lastBallSensor = -1; int lastBallStrength = 255; // Start at max distance unsigned long lastBallDetectionTime = 0; -bool ballLost = true; +bool ballLost = false; void setup() { // Initialize serial communication @@ -158,10 +158,10 @@ void moveBasedOnSensor(int sensorNum, int strength) { } void trackBall() { - // Get IR ball direction from seeker (on I2C address 0x08) - Wire.requestFrom(0x08, 2); - - if (Wire.available() >= 2) { + // Get IR ball direction from seeker (on I2C address 0x10 / 2) + Wire.requestFrom(0x10 / 2, 2); + + if (Wire.available()) { int sensorNum = Wire.read(); // Sensor number (1-12) int strength = Wire.read(); // Strength of the signal (0-255, 0 is closest)