can i somehow use pinMode() command in main/loop? answer to a question i asked

i just wanted to make a point in regard to one of the very first questions i had posted here, this guy Jason who wrote the ultrasonic sensor sketch using pulseIn has achieved what i was talking about, in that its called from the main loop as a function ping() defined in an unsigned long from outside of the loop, very clever stuff.

see ino attached

ultrasound.ino (1.14 KB)

can i somehow use pinMode() command in main/loop?

Yes you can. There are times when it is absolutely required. The "Ping)))" sensors that share a pin between Trigger and Echo is one example. Another is using a pin as an Open Collector output so you can connect it in place of a button on a 3.3V device.

arduidiot: i just wanted to make a point in regard to one of the very first questions

This post does not make much sense without a link to the "first question" you are referring to.

...R

well it depends on what they want. if they want to verify the authenticity of the statement that the original post regarding the subject exists or not. because i restated the question in the title the reader is given the necessary information.

i just thought id post questions i had hopefully reducing the number of newb questions the more experienced ones have to bother with? i mean im new so i assume there to be other new people having similar questions

I2C would be impossible without it.

arduidiot: if they want to verify the authenticity of the statement that the original post regarding the subject exists or not.

Why would I doubt its existence?

I just want to read it. Please post a link to it.

...R