28526 keeps poping up in my serial monitor
#include <Servo.h>
#include <Stepper.h>
const int trigPin = 9;
const int echoPin = 10;
const int SW_pin = 2; // digital pin connected to switch output
const int X_pin = A0; // analog pin connected to X output
const int Y_pin = A1; // analog pin connected to Y output
const int L_Wheel = 4;
const int R_Wheel = 7;
int printing;
float duration, distance;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(SW_pin, INPUT);
pinMode(R_Wheel, OUTPUT);
pinMode(L_Wheel, OUTPUT);
digitalWrite(SW_pin, HIGH);
Serial.begin(9600);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Path Finding
if (distance >= 20) {
digitalWrite(R_Wheel, HIGH);
digitalWrite(L_Wheel, HIGH);
int direction = 'Forward';
}
else if (distance <= 20) {
digitalWrite(R_Wheel, LOW);
digitalWrite(L_Wheel, LOW);
}
duration = pulseIn(echoPin, HIGH);
distance = (duration*.0343)/2;
if (printing == 'on') {
Serial.print("Distance: ");
Serial.println(distance);
Serial.print("Switch: ");
Serial.print(digitalRead(SW_pin));
Serial.print(" ");
Serial.print("X-axis: ");
Serial.print(analogRead(X_pin));
Serial.print(" ");
Serial.print("Y-axis: ");
Serial.print(" ");
Serial.println(analogRead(Y_pin));
}
else {
Serial.println('direction');
}
delay(100);
}
Only ussing sensor and motor for output on analog pin 4