Go Down

Topic: Digital pins 0-3 (Read 724 times) previous topic - next topic

Jim_Socks

Why do I never see them used in code?  Are they OK to use?

I am using them for a shiftin operation because all my other digital pins are used up, and I can't seem to get it to work properly.  I am asking here to see if maybe there is something special about those pins that I don't know...  I always thought it was funny no one seemed to use them in any sample code I have come across.

For full disclosure, I am using them through an Ethernet shield, but I think the Ethernet shield only uses pins 10, 11, and 12 for comunication so 0, 1, 2, and 3 should be OK?

AWOL

Zero and one are the serial pins.
Using them for other purposes makes debugging fiddly.
Two and three are the external interrupts, so tend do be reserved
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

robtillaart

using 0 and 1 is OK but you probably should disconnect these pins when you want to upload.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Jim_Socks

Upload as in, a new version of the program from the Arduino IDE software, or upload data to/from the arduino via the Ethernet shield?

I am thinking you mean the former, which would mean I was good to use pins 0 and 1, but before pressing the upload button in the IDE, I should disconnect any connections there first, and re-attach them after upload is complete.  Right?

robtillaart

as in a new version of the program from the Arduino IDE software

You got it right!
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Jim_Socks

Well, through shiftin experiments I have found that both pins 0 and 1 are useless for a clock or latch pin, but that pin 0 works very well as a data pin IF disconnected during upload as mentioned above.  Pins 2 and 3 seem to be able to run the clock and latch pins just fine.

Pin 1 is just plain useless.  It doesn't care if you set it to input or output, or try to digitalWrite to it or anything... it just does whatever it wants to do.  Would be nice to be able to put it to work.  "Get a job Pin 1!"  lol


retrolefty

Quote
Pin 1 is just plain useless.  It doesn't care if you set it to input or output, or try to digitalWrite to it or anything... it just does whatever it wants to do.  Would be nice to be able to put it to work.  "Get a job Pin 1!"  lol


That statement doesn't make a lot of sense to me. Other then if you have a serial.begin(xxxx) statement in your sketch, in which case the chips serial hardware will take over control of pin 1 as the serial output pin.

Can you post some short example coding where pin 1 does not perform as you would expect?

Lefty

Jim_Socks

That would be the reason, then!  I AM using Serial.begin(9600); and Serial.printin(); commands.

That must be why it's not responding to my other requests of it.  You just taught me something new- thanks!

retrolefty


That would be the reason, then!  I AM using Serial.begin(9600); and Serial.printin(); commands.

That must be why it's not responding to my other requests of it.  You just taught me something new- thanks!


Your welcome.

Bye the way there is a Serial.end() function you can use to release control of pin 1 so you can once again control it with digialWrite() commands, however you will miss any incoming serial data to pin 0 after the Serial.end() is performed, until you once again perform a serial.begin(xxxx) statement.

Lefty

fungus


Pin 1 is just plain useless.  It doesn't care if you set it to input or output, or try to digitalWrite to it or anything... it just does whatever it wants to do.  Would be nice to be able to put it to work.  "Get a job Pin 1!"  lol


Did you try disabling the USART...?

When the USART is enabled it overrides normal pin functions.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Go Up