Go Down

Topic: port initialization (Read 993 times) previous topic - next topic

beginner_wan

hi guys.. im a new user of arduino.. i just want to ask if i can initialize a port?

int portLED = PORTD;
void setup ()
{
 portMode(portLED, OUTPUT);
}

void loop()
{
 portWrite(portLED,HIGH);
 delay(500);
 portWrite(portLED,LOW);
 delay(500);
}

im trying to compile the code above but i shows some error message  :'(.. i hope you can help me guys.. thank you so much..

mem

#1
Aug 12, 2008, 06:54 am Last Edit: Aug 12, 2008, 06:55 am by mem Reason: 1
There is no arduino command in the form you tried that will write all bits to a port at once. If you need to do this you can use the low level functions for direct port IO. The reference page on port manipulation is a good place to start: http://www.arduino.cc/en/Reference/PortManipulation

beginner_wan

ok sir... i'l try it.. thank you so much!  ;D

mem

#3
Aug 12, 2008, 07:11 am Last Edit: Aug 12, 2008, 07:12 am by mem Reason: 1
Oh, I forgot to mention that there is a link to a good tutorial on bitwise math on that page, its well worth reading this if you need help on working with code that operates on some but not all bits.

Have fun!

Go Up