Hi all,
So I have a NPN Proximity sensor sending input to an arduino. Everything is working great except when the sensor is sending input to the arduino, then I set the arduino to a "inactive" mode, then reset it back to "active" mode. After this is done, the input from the sensor stays as HIGH even if the sensor isn't activated.
The sensor works fine till its interrupted by the arduino so I don't believe its a pull down resistor issue but I could be wrong I suppose.
railCheck = digitalRead(sensorArray[4]);
if ((railCheck == HIGH) && (railCheckNext == 0)) {
Serial.println("Rail Check Activated");
previousTimer2 = currentTime;
digitalWrite(panelLed5, HIGH);
digitalWrite(solenoidArray[6], HIGH);
railCheckNext = 1;
}
if (railCheckNext == 1) {
railCheck = digitalRead(sensorArray[4]);
if (railCheck == LOW) {
previousTimer2 = currentTime;
railCheckNext = 2;
}
}
if (railCheckNext == 2) {
railCheck = digitalRead(sensorArray[4]);
if (railCheck == HIGH) {
railCheckNext = 1;
}
if ((railCheck == LOW) && (currentTime - previousTimer2 >= sysArray[5])) {
digitalWrite(solenoidArray[6], LOW);
digitalWrite(panelLed5, LOW);
previousTimer2 = currentTime;
Serial.println("Rail Check Finished");
railCheckNext = 0;
}
}
Sensor Information:
Model#: lj18a3-8-z/bx
So again, the above code works fine, till the arduino stops reading the sensors input while its "LOW", then the output from the sensor stays HIGH. So its reading 5V instead of 0V. I've used my meter to check this and the output from the sensor is sending 5V when it should be 0V. Ideas? confused?