Hi, this might be again, absurd questions for you guys.
Uhmmm, Im doing a project. Basically, I need 6 digital pins for driving the two shift registers and two (4-bit) 4PIN INPUTS. So that makes it 4+4+(3+3) = 14 pins!
Anyway, I can make that down to 13 or 12. But that would be hard for me, really.
My question is:
-
Can I Use the RX and TX pins (0 and 1 pin?)
Im compiling the codes using the breadboard.
-
Can I use the Analog input pins for my DIP Switches? Basically, you know, the switches are used for only HIGH and LOW. Now, Im wondering if it is possible to use Analog pins.
Thanks!!!
glenn
- Can I Use the RX and TX pins (0 and 1 pin?)
Yes, if you don't need Serial I/O. You may need to disconnect hardware from 0 and 1 to upload sketches so it is best not to use them if you don't need to.
- Can I use the Analog input pins for my DIP Switches?
Yes. Call them pins 14 through 19 and use them exactly like any other digital pins. A0 through A5 are defined as 14 through 19 so you can use the names directly:
pinMode(A0, INPUT);
pinMode(A1,OUTPUT);
byte value = digitalRead(A0); // use analog input A0 as a digital input
digitalWrite(A1, value); // use analog input A1 as a digital output
You can also daisy-chain shift registers so all of your registers will be on the same 3 pins. You shiftOut() one byte for each shift register in the chain. If you want REALLY FAST shifting you can use the SPI hardware. That can shift out up to 8 million bits per second.
johnwasser:
- Can I Use the RX and TX pins (0 and 1 pin?)
Yes, if you don't need Serial I/O. You may need to disconnect hardware from 0 and 1 to upload sketches so it is best not to use them if you don't need to.
- Can I use the Analog input pins for my DIP Switches?
Yes. Call them pins 14 through 19 and use them exactly like any other digital pins. A0 through A5 are defined as 14 through 19 so you can use the names directly:
pinMode(A0, INPUT);
pinMode(A1,OUTPUT);
byte value = digitalRead(A0); // use analog input A0 as a digital input
digitalWrite(A1, value); // use analog input A1 as a digital output
You can also daisy-chain shift registers so all of your registers will be on the same 3 pins. You shiftOut() one byte for each shift register in the chain. If you want REALLY FAST shifting you can use the SPI hardware. That can shift out up to 8 million bits per second.
WOW! Great answer!
Thank you sir JW!
Actually, I knew I could use the RX and TX, as Arduino website says, but not with Serial I/O (like what you've said).
I tried to compile my codes, and voila! It worked!
I just need to float (or perhaps set it to high) the RX/TX pins during compilation. I noticed that if they are set to GND, IDE won't compile.
Thanks for your answer in no.2
Ill try to use the analog pins if necessary. Thanks a ton!
=-glenn p.