Hey guys,
I am having a trouble when I connect and infrared proximity sensor (
http://www.sparkfun.com/products/242) and an preamplified electret microphone (
http://www.sparkfun.com/products/9964).
When I connect the sensors separately, they work perfect, but when I connect both together the electret microphone reads signal of 1023 (5V) at all time.
Do I have to get the voltage from different power sources? That would be very weird.
Thanks,
Here I leave you the electret mic sketch to read the signal if its necessary.
const int micPin = A2;
int valueMic = 0;
int valueMicMax = 512;
int valueMicMin = 512;
void setup() {
Serial.begin(9600);
}
void loop() {
for (int i =0; i < 100; i++){
valueMic = analogRead(micPin);
if (valueMic > valueMicMax){
valueMicMax = valueMic;
} else {
if (valueMic < valueMicMin){
valueMicMin = valueMic;
}
}
}
valueMic = valueMicMax-valueMicMin;
Serial.println(valueMic);
valueMicMax = 512;
valueMicMin = 512;
}