Quick question on analogread and write resolution.

I'm using a Due and was wonder if I only need to set the resolutions once in the set up or every time before i use the read or write command. The example on this website did it before every write command.

Can you link the example?

analogRead() returns a value between 0 and 1023, so that is your resolution.

analogWrite() takes a value between 0-255.

*Edit: Sorry leak, just read about the Dues ability to set the resolution. And the honest answer is I don't know without getting a scope on it.

You only need to set it once in setup(), unless you are changing it in the middle of your program, which would be a bad idea.

Which website? Your link is missing.

You change it whenever you want, as often as you want as far as I know, it will then
apply to subsequent analogRead() and analogWrite() calls. Why wouldn't it? Internally
I think everything is done with 12 bit resolution, just the arguments and results of
calls to analogWrite and analogRead are shifted to match.