Go Down

Topic: Writing port pins as output (Read 264 times) previous topic - next topic

be80be

I've looked around but have not found if you can use this code

Code: [Select]
int powOn = 3;

void setup () {
pinMode(powOn, OUTPUT);
}
void loop () {
     powOn = 1  // Is this usable
}
}

// or should it just be done this way
digitalWrite(powON, HIGH);   // is this the only usable way



I guess what I'm asking is can you just set a pin high by using a 1 or do you have to use digitalWrite for
outputs

Grumpy_Mike

Quote
powOn = 1  // Is this usable

All that does is to set thevalue of the variable to one, not the state of the pin. You need digitalWrite or direct port manipulation to do this.

be80be

Thanks It was looking like that's the only way so Now I no thanks


Go Up