SparkFun Forums 

Where electronics enthusiasts find answers.

Tips, tricks, & best best practices using Artemis with your board designs.
User avatar
By matthewpw

I'm a beginner and struggling pin definitions in Arduino. paulvha started to set me straight over here: viewtopic.php?f=169&t=58525 but I'm moving on to adding buttons to my project and I'm clearly not getting it. I'm looking at the Schematic, Apollo3 Datasheet, and Integrations Guide here:

When I connect a switch to the pin labelled 13 on the board, the following code works:
Code: Select all
int soundOut = A16;
int buttonOne = 13;

void setup() {
  // put your setup code here, to run once:
  pinMode(soundOut, OUTPUT);
  pinMode(buttonOne, INPUT_PULLUP);

void loop() {
  // put your main code here, to run repeatedly:
    if (digitalRead(buttonOne) == LOW){
      tone(soundOut, 440, 100);
      tone(soundOut, 880, 100);
If I wanted to use pin A14 instead, what would that look like?

I obviously don't understand the difference between the AX pins and the X pins or how to configure them. What can each of them be and how do I make them so?

Thanks in advance.

User avatar
By matthewpw
I'm finding this forum which I also can't entirely parse: viewtopic.php?f=169&t=57715.

I don't need to dynamically assign any pins — hadn't gotten far enough to consider it, really. I'm looking around for tutorials that cover addressing pins more generally but I'm not finding much right off the bat. Pointers to good learning resources on this topic are welcome!
By jremington
Please state the exact board are you using.
In any case, look for a complete pinout guide, published for most of the popular boards. Next to each pin is an abbreviated description summarizing that pin's various capabilities.
Most of the pins with "A" labels can be used as either analog input or digital I/O, the ones labeled with decimal digits are digital I/O only.

Pointers to good learning resources on this topic are welcome!
If you are using the Arduino IDE to program, ALWAYS consult the Arduino Reference:

Example pinout for the classic Arduino Uno:
You do not have the required permissions to view the files attached to this post.
User avatar
By matthewpw
Thanks @jremington.

You've put your finger exactly on it. I thought the AX pins could still be used for digital but I can't make code that will work with them for the switch input. It's got to be simple and I'm just dense.

What code adjustment do I need to use the A14 pin, for example on the Artemis Nano? I apologize for not naming the board explicitly, but that's where the product/doc link in my post lands and is the reason I'm posting in an Artemis forum. The Android forums are also helpful but no one there seems to know how to use the Artemis boards.

I am referencing the Arduino documentation you link to. It's well made and makes sense to me, generally, but doesn't give insight into how to address the Artemis Nano. I have a much harder time with the Artemis docs than the example diagram you've posted here. There's lots available on the UNO and maybe I should just switch boards but the form factor and cost of the Artemis Nano — as well as benefit for understanding it well to do more complicated projects in the future — are the draw.

In the meantime I found some good guides on using registers but all of those examples are for Arudino Uno and I'm also not doing a good job of understanding of how to read the Artemis Nano docs to understand it similarly.
By jremington
I looked through the material for a pinout diagram for the Artemis Nano and could not find one. Or a table. It looks like Sparkfun has not done a great job of documenting the precise capabilities of the various pins on the Artemis Nano. Perhaps one of the developers can chime in here. Or you could post an issue on the Github site.

Checking the schematic, the pin labeled A14 has several alternative digital functions (see image below), so in principle it can be used as general digital I/O. However, the Arduino IDE has a lookup table specific to each board that specifies the allowed pin functions, and whoever created that table may not have provided a path for using the pin as digital I/O.

To address your problem, several pins on the right side of the schematic have labels beginning with "D" e.g. 4,6-13 and a couple of others, so try using one of those for digital I/O instead.

Some Arduinos do have "analog only" pins, and in those cases you simply have to be aware of the exceptions to the rule.
You do not have the required permissions to view the files attached to this post.
By paulvha
Looks indeed this is missing, but Actually for the Nano is very straightforward:
Code: Select all
On BOARD	PinName
4	         D4
6	         D6
7	         D7
8	         D8
9	         D9
10	        D10
11	        D11
12	        D12
13	        D13
A16	        A16 or D16
A15	        A15 or D15
A14	        A14 or D14
A5	        A5 or D5
A3	        A3 or D3
A2	        A2 or D2
A1	        A1 or D1
A0	        A0 or D0
So 13 is D13
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]