Pages: [1]   Go Down
Author Topic: port initialization  (Read 887 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

London
Offline Offline
Faraday Member
**
Karma: 10
Posts: 6248
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: August 11, 2008, 11:55:28 pm by mem » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

London
Offline Offline
Faraday Member
**
Karma: 10
Posts: 6248
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
« Last Edit: August 12, 2008, 12:12:53 am by mem » Logged

Pages: [1]   Go Up
Jump to: