Detecting Ground Pulse from exteral device

Hi

I have a tracking device that lets me send commands to it to perform certain functions

One example is I have a led connected to 12v power and ground output from the tracking device

When i send a specific comment to the device i can control the number of times the led fashes, the duration of each flash, all controlled by the tracker sending relevant pulses via the ground out

I have the ground out connected to pin 4 and then the ground attached to the led connected to pin 13

Sending the command to the tracker with wires going through arduino works as expected

My challenge is i want to detect the pulse from the pin 4 so i can see what value is being passed when the led is flashing versus when its idle

the only output i am seeing in serial monitor is 0 regardless of if led is flashing sequence or idle

void setup() {
//start serial connection
Serial.begin(9600);
//configure pin 2 as an input and enable the internal pull-up resistor
pinMode(4, INPUT);
pinMode(13, OUTPUT);

}

void loop() {
//read the pushbutton value into a variable
int sensorVal = digitalRead(13);
//print out the value of the pushbutton

// Keep in mind the pull-up means the pushbutton's logic is inverted. It goes
// HIGH when it's open, and LOW when it's pressed. Turn on pin 13 when the
// button's pressed, and off when it's not:
if (sensorVal == HIGH) {
Serial.println(sensorVal);
} else {
Serial.println(sensorVal);
}
}

Hello Trackingcentral,
Can you please read:
General guidance and
How to use this forum
Especially item #7 on posting code, then modify your original post to include code tags as per the instruction.

You have defined pin 13 as an output, which is fine as it is the in built LED, but then you read it as an input:

int sensorVal = digitalRead(13);

No where do you read the state of pin 4, so you are never going to see what it’s value is. Read pin 4.

Have you done the exercises and tutorials in the IDE and on this web site? If not, please do, the answers are in there.

I recommend working through this introduction.
Arduino Programming Course

it is easy to understand and has a good mixture between telling important basic concepts details and move on to get you going.

Me myself I'm a somehow advanced programmer some where inbetween total newbee and highest sophisticated.
If I try to estimate the easyness of understanding of a tutorial I'm not best suited if it is easy to understand because of my knoweldge. Best suited are people that are completely new or almost new to programming.

So I would like to hear from you if this tutorial is easy to understand for you.

If anybody happends to know another easy to understand beginners tutorial please post a link. I'm collecting them.

best regards Stefan

I have a tracking device

I'm sorry but this is no use to us, we need to know exactly what hardware(*) you have, which
means posting at least a link to the product page or better still datasheet for the device you are
talking about.

Please take time to draw out the circuit and include that, your description in words is very hard to
follow and probably ambiguous.

(*) Every bit of hardware, the tracking device, the LED, the power supply, and which Arduino. Details
in electronics are all important.