Pages: [1]   Go Down
Author Topic: Writing port pins as output  (Read 244 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 3
Posts: 249
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 626
Posts: 34132
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Full Member
***
Karma: 3
Posts: 249
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Pages: [1]   Go Up
Jump to: