So I'm trying to make a sound following robot, but I'm getting weird readings from my sensors...
I'm using a DFRobotShop Rover, NOT an UNO, I just couldnt find a good picture of the rover from above.
- DFRobotshop Rover with a duemilanove controller
- Two zxsound inex sound sensors
The sound sensors are supposed to just work with the 5v signal. It works perfectly if I try to use only one sensor, but messes up once I hook up the other sensor
This is my first post here so I'm sorry if the format is incorrect.
My code:
int Multiplier = 8;
int AnalogMax = 1023;
void setup() {
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
Serial.begin(9600);
}
void loop() {
int LeftEarBeta = analogRead(A2);
int RightEarBeta = analogRead(A3);
int LeftEar = (LeftEarBeta*Multiplier);
int RightEar = (RightEarBeta*Multiplier);
if(LeftEar>AnalogMax){
LeftEar=AnalogMax;
}
if(RightEar>AnalogMax){
RightEar=AnalogMax;
}
Serial.print(LeftEar);
Serial.print(" ");
Serial.println(RightEar);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
analogWrite(5, LeftEar);
analogWrite(6, RightEar);
delay(20);
}
The multiplier int is just to make the motors more sensitive, but even if I set it at 1, the left mic is still picking up a constant signal of around 280?
What have I done wrong?

