Digitalread

Trying to learn code so here is my question,

Can the Digitalread on an output pin be used to increment a counter to perform a function?

Writing something as an output, reading it, and then writing it again to preform something else seems a little redundant.

Do you mean reading an input?

No I was wondering if I could count the number of times an output to a LED went from low to high .
To use that, to increment a counter so after x number of flashes the Led could be turned off.
I am just starting to learn programming and unsure of the best way to perform some of these functions

You can but not directly with digitalRead() - this function does not return the number of time the light went on... it just tells you if the pin is HIGH or LOW at that instant.

Indirectly you can monitor the status of a pin and see how often it changes through sampling.

Of course if your code is also doing the blinking, best is to count there...

Your question is very vague and lacks context. It is likely, almost certain, that what you want to do is possible. But you’d have to give some details about what you actually want to do to get a real answer

thanks

J-M-L explained it well enough, I see I need to do some more reading to get what I want .

Sorry. Our posts got crossed. When I wrote that you hadn't responded yet.

No I was wondering if I could count the number of times an output to a LED went from low to high .

The pin does not change state unless YOU tell it to. Count the number of times you tell it to change. Much simpler than checking whether the pin changed state.