Pages: [1] 2   Go Down
Author Topic: tx & rx pins  (Read 2542 times)
0 Members and 1 Guest are viewing this topic.
South East USA
Offline Offline
God Member
*****
Karma: 5
Posts: 650
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can I use digital pins 0 and 1 just like any other of the digital pins?  Does it just mean that I wouldn't be able to use the serial port back to my pc to get serial.print commands?

what about analog pins, how do I use them for simple digital pins, or can I?
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12744
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Can I use digital pins 0 and 1 just like any other of the digital pins?

Yup.

Quote
Does it just mean that I wouldn't be able to use the serial port back to my pc to get serial.print commands?

Yup.  You may have problems uploading the next Sketch.  Holding reset until the upload starts should get you through.

Quote
what about analog pins, how do I use them for simple digital pins, or can I?

They are accessed in exactly the same fashion (pinMode, digitalRead, digitalWrite).  The pin numbering starts at one more than the last digital pin.  For example...

http://arduino.cc/en/Main/ArduinoBoardUno

The last digital pin is "13".  Analog pin "A0" is also digital pin "14".  Analog pin "A1" is also digital pin "15".  Etcetera.

« Last Edit: February 22, 2011, 12:50:41 am by Coding Badly » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 518
Posts: 26378
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

D0 D1 are digital pins like any other.
They can't really do 2 things at once tho, so you do lose the Rx Tx cabability.
For Tx back to the PC, the stuff on the pin still gets sent over the Tx line, may appear as gibberish on the monitor.

A0-A5 can be used as D14-D19.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

South East USA
Offline Offline
God Member
*****
Karma: 5
Posts: 650
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can I use digital pins 0 and 1 just like any other of the digital pins?

Yup.

Quote
Does it just mean that I wouldn't be able to use the serial port back to my pc to get serial.print commands?

Yup.  You may have problems uploading the next Sketch.  Holding reset until the upload starts should get you through.

Quote
what about analog pins, how do I use them for simple digital pins, or can I?

They are accessed in exactly the same fashion (pinMode, digitalRead, digitalWrite).  The pin numbering starts at one more than the last digital pin.  For example...

http://arduino.cc/en/Main/ArduinoBoardUno

The last digital pin is "13".  Analog pin "A0" is also digital pin "14".  Analog pin "A1" is also digital pin "15".  Etcetera.


GREAT!
So there's actually 20 digital pins available on the Uno, then.  I thought someone said 19.
My first project is coming up with 19 pins.  Too bad it's not 18, then the serial would still be available.  I won't need it once I'm done coding, though.
I could use a shiftreg on my LCD, it looks pretty simple.  It looks easier than analoging a 4x3 keypad down to 1 pin.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 518
Posts: 26378
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

D0-D13, and A0-A5 (D14-D19). I guess that does make 20.

keypad down to 1 pin - there have been plenty of discussions on that too, using an analog input and a bunch of resistors.
Folks have shown successful examples.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 197
Posts: 12744
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If a lack of Serial becomes too much of a burden and you have one unused pin, let me know.  I may be able to help.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My first project is coming up with 19 pins.  Too bad it's not 18,
Post the requirements or a schematic, maybe someone can save you a pin or two.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What about this multiplexer:  http://www.robotsimple.com/sparkfun_Analog_Digital_MUX_Breakout

That would free up a lot of pins on your Uno.
Logged

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

nice mux andy

and what about the good old shift registers ? 74HC595 &  74HC165 ?
Logged

Rob Tillaart

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 518
Posts: 26378
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Once SouthernAtHeart comes back we can see what he's doing with all these pins.
In other posts he has asked about driving motors and keypad interfacing.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

South East USA
Offline Offline
God Member
*****
Karma: 5
Posts: 650
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Once SouthernAtHeart comes back we can see what he's doing with all these pins.
In other posts he has asked about driving motors and keypad interfacing.

I'll fill you in here on my project, later today, if you promise not to laugh!
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 518
Posts: 26378
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

well you've mentioned a wide track 4' robot, motors, keypad for # of coffee cups, what else are you adding?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

South East USA
Offline Offline
God Member
*****
Karma: 5
Posts: 650
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's the coffee lovers' automaton.
Your coffee maker sets in the kitchen cabinet, at counter top level.  A few knocks on the door (user customizable knocks) brings the self grinding machine out, opening the doors on it's way.  the dovetailed platform mounted on undermount drawer glides will be likely driven by Sparkfun's 100:1 gearmotor.  (Although, a stepper motor controled by a rotary encoder option moving the platform precisely how you want it sounds 'nice'.)
  Then you are looking at a nice anodized aluminum enclosure housing a 4x3 keypad and an LCD display giving helpful tips to enter the number of cups of coffee you think you need to get you going.  (the user will also have the option to 'bring on the coffee" by the keypad, if they're not up to knocking).  Upon pressing start, your Asco NEMA rated water valve opens, and begins filling your coffee pot with the designated amount of water through 1/4" tubing routed from the undersink water filter system.  The tubing is connected to the underside of the platform not unlike that ribbon connected to your printhead that allows it to move back and forth.  The water is being monitored by seeedstudio's flow sensor.  The # of pulses for each water setting (2,4,6,8,10) is stored in EEPROM, so it is user configurable using a secret keycode to enter the setup menu.  The setup menu will also allow you to choose options:  Enable knock sensor, enable photocell (if it's a dark early morning, the LCD screen in standby mode may show some ZZZZZZZZZZZZZZ's on the screen).  Another option will be to enable audio.  Ever hear the melodic tone played by one of these expensive washing machines when it's done?  Not sure until I experiment, if I get that nice of a sound from 1 I/O pin, to give a little 'cupboard door open' and 'cupboard door closed' tone.
  So, that about maxes out my Uno's pins.  (I'm wondering how far into this paragraph I maxed out it's 2K of ram?)  I'll be asking for help on that after my Uno comes in 2 days.
   I can't think of any other sensors to incorporate, unless it's SparkFun's Optical Detector http://www.sparkfun.com/products/246 to monitor when to turn the gearmotor off upon opening and closing of the coffee platform.  That might be easier than trying to wire up 2 unseen limit switches ...I'm still pondering that area of the project...
  It's kind of interesting, I'd never even heard of Arduino a month ago!
    I'll probably be coding, decoding, and recoding for awhile.  I didn't know the first thing about C++, but this forum has been REALLY helpful and enjoyable.
  So, that's my project. smiley



* sensor.bmp (468.8 KB, 400x400 - viewed 11 times.)

* valve.jpg (8.52 KB, 200x194 - viewed 11 times.)

* keypad.jpg (39.67 KB, 600x600 - viewed 11 times.)

* enclosure.jpg (37.09 KB, 400x262 - viewed 14 times.)
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8471
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I can't think of any other sensors to incorporate,
Heck there's a lot of sensors around, I'm sure you can add a few, for example isn't it important to have the coffee at just the right temperature. smiley

Sounds real interesting and a fun project. I lost track of the pins required, when you get a schematic (even a rough one) give us a look and we may be able to trim things a bit.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

South East USA
Offline Offline
God Member
*****
Karma: 5
Posts: 650
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd be happy to post my code with offers on improvement!  If that's not imposing on anyone...
If it's split up into tabs, is there any way to post it here?  Or just zip it up and attach?
Logged

Pages: [1] 2   Go Up
Jump to: