Illinois, US
Offline
Jr. Member
Karma: 2
Posts: 97
|
 |
« on: February 03, 2013, 12:54:31 pm » |
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
Brattain Member
Karma: 142
Posts: 19338
I don't think you connected the grounds, Dave.
|
 |
« Reply #1 on: February 03, 2013, 12:57:17 pm » |
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.
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 100
Posts: 9548
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #2 on: February 03, 2013, 02:02:28 pm » |
using 0 and 1 is OK but you probably should disconnect these pins when you want to upload.
|
|
|
|
|
Logged
|
|
|
|
|
Illinois, US
Offline
Jr. Member
Karma: 2
Posts: 97
|
 |
« Reply #3 on: February 03, 2013, 03:39:26 pm » |
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
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 100
Posts: 9548
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #4 on: February 03, 2013, 03:47:25 pm » |
as in a new version of the program from the Arduino IDE software
You got it right!
|
|
|
|
|
Logged
|
|
|
|
|
Illinois, US
Offline
Jr. Member
Karma: 2
Posts: 97
|
 |
« Reply #5 on: February 03, 2013, 04:17:27 pm » |
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
Brattain Member
Karma: 282
Posts: 15435
Measurement changes behavior
|
 |
« Reply #6 on: February 03, 2013, 05:41:58 pm » |
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
Jr. Member
Karma: 2
Posts: 97
|
 |
« Reply #7 on: February 03, 2013, 06:41:24 pm » |
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
Brattain Member
Karma: 282
Posts: 15435
Measurement changes behavior
|
 |
« Reply #8 on: February 03, 2013, 07:01:53 pm » |
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
Offline
Edison Member
Karma: 72
Posts: 2488
|
 |
« Reply #9 on: February 04, 2013, 01:51:12 am » |
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...
|
|
|
|
|