Can I analogRead in Setup( ) ?

can I initial a value with analogRead in setup function?

void setup() {
bla bla bla bla bla 
  pval = map(analogRead(potpin),0,1023,0,100);
}

Yes.

can I initial a value with analogRead in setup function?

I'm certain that you could have tried in the time that it took you to post the question and wait for Coding Badly to reply.

Yes. It is quite common to do:

randomSeed(analogRead(0));

in setup().

PaulS:

can I initial a value with analogRead in setup function?

I'm certain that you could have tried in the time that it took you to post the question and wait for Coding Badly to reply.

Yeah, especially since the test code was about written, except maybe for a Serial.print to check it.

PaulS:

can I initial a value with analogRead in setup function?

I'm certain that you could have tried in the time that it took you to post the question and wait for Coding Badly to reply.

Please let's remember that there are times when something appears to work correctly, but there are non-obvious reasons why it is still a bad idea, or is actually not working correctly. Just because the code compiles and appears to produce valid results doesn't mean it's inappropriate for an inexperienced person to post here making sure that all is well.