Hi,
I'm junior level maker and messing with an old parking sensor just for fun and to learn new things.
I've searched through forum and found couple subjects how to read parking sensors but it's little bit complicated for me so i want to try a different approach to do so.
As you can see in picture my parking sensor has a led screen that shows you to distance of the object on the right and left
I thought i can read first LED's status to find out which sensor triggered by obstacle(It's range is 1.5 meters, when an obstacle started to get closer to the sensor first led is on and it continue as the obstacle is getting closer.).
Second picture :
So there are 7 leds but 8 pins, 8th pin is GND and the first pin is first led's VCC, when i check with multimeter in buzzer mode there are no signal (closed circuit/multimter is not beeping) between first pin and GND, but when sensor triggered first led is on and multimeter beeping (circuit is closing). Ground is connected to GND on arduino MEGA and the LED's vnc is connected to 52th port.
I thought i can read closed circuit with using "INPUT_PULLUP" method and writed my code like below;
int LEFT = 52;
void setup()
{
Serial.begin(9600);
pinMode(LEFT, INPUT_PULLUP);
}
void loop()
{
int LEFTSTATUS=digitalRead(LEFT);
if (LEFTSTATUS==HIGH)
{
Serial.print("LEFT SENSOR TRIGGERED");
Serial.println("");
}//LEFT IS HIGH
else
{
Serial.print("IDLE");
Serial.println("");
}
}
when there is no trigger serial output is "IDLE" but when sensor triggered monitor is going crazy as below;
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
IDLE
LEFT SENSOR TRIGGERED
It seems like somehow LED is on and off like under 1 second.
After many tries i've changed my approach to read LED's status and changed my code as below;
int LEFT = 52;
void setup()
{
Serial.begin(9600);
pinMode(LEFT, INPUT);
}
void loop()
{
int LEFTSTATUS=digitalRead(LEFT);
if (LEFTSTATUS==HIGH)
{
Serial.print("LEFT SENSOR TRIGGERED");
Serial.println("");
}//LEFT IS HIGH
else
{
Serial.print("Im IN SPACE :)");
Serial.println("");
}
}
Unfortunatelly it doesn't work and the serial output only says "IDLE" even if the led is on.
Also there is a buzzer on the screen, i've cutted it's cable and connected it's GND to GND on arduino MEGA and the VNC to the 52th port, when i run my code it's perfectly working, i mean if there is no obstacle it says IDLE and when there is an obstacle it says TRIGGERED, but the problem is buzzer rings when any sensor triggered, there is no way to seperate as LEFT or RIGHT.
I know i can set-up same system with using sonic sensor but as i said i'm junior level and just trying to learn new things from experienced friends & communities.
Thanks in advance any ideas will be appreciated.