element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Best practices for Arduino I/O selection
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 19 replies
  • Subscribers 388 subscribers
  • Views 4140 views
  • Users 0 members are here
  • arduino_development_environment
  • arduino
Related

Best practices for Arduino I/O selection

colporteur
colporteur over 3 years ago

I'm currently working on a project using an Arduino knock-off Mega board. I discovered during prototype board development and testing an issue using I/O' 0 and 1. I found I could not control the output within my script. From online research, I discovered if I was using serial communication then I should avoid using those two I/O's. I wonder what other gotcha's don't know about?

I confess I am way down the scale of Arduinos knowledge. I label myself more of a resurrectionist rather than a programmer. I adapt code and solutions I find to solve my problems. Rarely if ever, have I built from scratch. This leads me to the title line "Best Practices for Arduino I/O selection". Are there any resources that provide this type of guidance? Are there I/O's to avoid and others that are better for a specific function?

I realize some I/O's are for specific purposes. I'm just thinking are there best practices using I/O's. I read the review posted on the site of this new book and thought maybe that has some suggestions. I'm looking for member experience.

  • Sign in to reply
  • Cancel

Top Replies

  • Jan Cumps
    Jan Cumps over 3 years ago in reply to shabaz +7
    I use the same principles but the other way round. I first do the inflexible ones, like UART, i2c/SPI, pwm/timer , interrupt and analogue. Then sprinkle the easy ones across what's left over.
  • fmilburn
    fmilburn over 3 years ago +7
    I've been caught out with this type of problem when using the Arduino IDE with a board I'm unfamiliar with so I can relate. In your case, the pins with the labels 0 and 1 on the silkscreen will cause a…
  • shabaz
    shabaz over 3 years ago +5
    Hi Sean, The usual board pinout diagrams often indicate all functions available per pin, so they can be used for guidance, but the ultimate authority is the chip datasheet. Example snippet (found via…
Parents
  • fmilburn
    fmilburn over 3 years ago

    I've been caught out with this type of problem when using the Arduino IDE with a board I'm unfamiliar with so I can relate. In your case, the pins with the labels 0 and 1 on the silkscreen will cause a conflict since they also have RX and TX beside them which are used for the serial terminal.  The Arduino reference documentation (as well as the material Dave linked) covers this as shown in the excerpt below.

    image

    But even here they don't state that pins 18 and 19 are set up using Serial1 as opposed to plain Serial for pins 0 and 1.  For that you have to look in the Serial.begin() documentation and it is also shown on the silkscreen.  So the information is spread about.

    The Arduino documentation is pretty good about specifying these things for the Uno in the documentation but the further you stray from that model the less likely that is to be so.  There are so many different processors that use the IDE now (many not even developed by Arduino) it isn't possible to cover them all in one place and it is necessary to pay close attention to the board pinout.  By the time you get to some of the Espressif boards, all bets are off.  Some of the silkscreens are awful and there is only generic information at best.

    The sources that beacon_dave gives are as good as any I know of along with the documentation in the Arduino reference.  But it is hard to avoid unexpected issues and use of google, especially when using a new board.  Boards with daughterboards/shields having sensors, screens, buttons, and such are often problems as they take away pins.

    • Cancel
    • Vote Up +7 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • fmilburn
    fmilburn over 3 years ago

    I've been caught out with this type of problem when using the Arduino IDE with a board I'm unfamiliar with so I can relate. In your case, the pins with the labels 0 and 1 on the silkscreen will cause a conflict since they also have RX and TX beside them which are used for the serial terminal.  The Arduino reference documentation (as well as the material Dave linked) covers this as shown in the excerpt below.

    image

    But even here they don't state that pins 18 and 19 are set up using Serial1 as opposed to plain Serial for pins 0 and 1.  For that you have to look in the Serial.begin() documentation and it is also shown on the silkscreen.  So the information is spread about.

    The Arduino documentation is pretty good about specifying these things for the Uno in the documentation but the further you stray from that model the less likely that is to be so.  There are so many different processors that use the IDE now (many not even developed by Arduino) it isn't possible to cover them all in one place and it is necessary to pay close attention to the board pinout.  By the time you get to some of the Espressif boards, all bets are off.  Some of the silkscreens are awful and there is only generic information at best.

    The sources that beacon_dave gives are as good as any I know of along with the documentation in the Arduino reference.  But it is hard to avoid unexpected issues and use of google, especially when using a new board.  Boards with daughterboards/shields having sensors, screens, buttons, and such are often problems as they take away pins.

    • Cancel
    • Vote Up +7 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube