Page 1 of 1

Help arduino pin codes

Posted: Mon Aug 12, 2013 9:01 am
by brian25
Hi guys, can you control the pins of arduino simultaneously?

Is this possible using array?
Pin 1 = 11;
Pin 2 = 10;
Pin 3= 9;
Pin 4= 8;



Char Old[]= {"11, 10, 9, 8};


Void setup()
{

}


Void loop()
{
Char ;
Char new []= {"1111"};
i = new;
if (strcmp(new, "1111") == 0 && strcmp(old, "1111"){
Digitalwrite( i, high);
}

the concept is if the two variable matches it will execute the 4 pins high output at the same time and when 0000 it will execute low simultaneously..


Tnx

Re: Help arduino pin codes

Posted: Mon Aug 12, 2013 12:10 pm
by fusedlightning
The Arduino language does not support simultaneous pin changing.

However, if you're feeling adventurous, you can directly access the hardware registers that control the state of these output pins. The board has 3 different pin busses, and pins on the same bus can be changed in the same instruction cycle.

Directions for the Arduino R3 (and similar) can be found here. Just be warned, if you muck with TX/RX accidentally, really strange things can happen.
http://www.arduino.cc/en/Reference/PortManipulation

Re: Help arduino pin codes

Posted: Mon Aug 12, 2013 1:54 pm
by waltr
Just an FYI.
This is the PIC micro-control forum. There is a separate Arduino forum.

Re: Help arduino pin codes

Posted: Mon Aug 12, 2013 8:24 pm
by fusedlightning
Thanks. Didn't look to see where it was posted before replying.