Pages: [1]   Go Down
Author Topic: Digital pins 0-3  (Read 506 times)
0 Members and 1 Guest are viewing this topic.
Illinois, US
Offline Offline
Jr. Member
**
Karma: 2
Posts: 97
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24328
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12448
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Rob Tillaart

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

Illinois, US
Offline Offline
Jr. Member
**
Karma: 2
Posts: 97
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12448
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

You got it right!
Logged

Rob Tillaart

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

Illinois, US
Offline Offline
Jr. Member
**
Karma: 2
Posts: 97
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16517
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Illinois, US
Offline Offline
Jr. Member
**
Karma: 2
Posts: 97
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16517
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Valencia, Spain
Online Online
Faraday Member
**
Karma: 118
Posts: 4553
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

No, I don't answer questions sent in private messages...

Pages: [1]   Go Up
Jump to: