Basic question: Pin modes and enums

Hi all, I have a basic question about pin modes. I have noticed that when you are setting digital output pins you can call digitalWrite() with 0 or 1 instead of LOW or HIGH, respectively. Is it also possible do do this with pinMode()? If so, which number corresponds to INPUT, and which corresponds to OUTPUT?

If you really want to do things that way have you tried printing the values of INPUT and OUTPUT ?

Going based on the port manipulation methods where you use 1 for output, I'd say 1 for output, 0 for input. If you want INPUT_PULLUP called in pinMode() without actually inputing "INPUT_PULLUP" you can call an input as input and then digitalWrite it high.

Thanks for the help! I'll try printing INPUT and OUTPUT when I get home, just to be sure.

Thanks for the help! I'll try printing INPUT and OUTPUT when I get home, just to be sure.

Why? INPUT and OUTPUT are clear, unambiguous terms, like HIGH and LOW. Yes, they have numeric values, but the numeric values convey less meaning. There is nothing to be gained by making your code less readable. Why do you want to do that?

Perhaps he just wanted to know how stuff works, yeah? Perhaps it is just for academic knowledge? And it's his code he can do whatever he likes.

And it's his code he can do whatever he likes.

Like you using first and second to define the array index names, where everyone else uses row and column. Yeah, I saw how that worked for you.

It is possible to replace any defined constant value with the equivalent literal value, but it is not a sensible thing to do and I can't think of any good reason for doing it. If you're interested in finding out what values particular constants have on a given platform, the Arduino runtime source is available for you to look that up. That doesn't mean it is sensible to use the equivalent value instead of the defined constant - it isn't.