Skip to content

Add aliases for the analog input pins (A0, A1, etc.) [imported] #244

@cmaglie

Description

@cmaglie

This is Issue 244 moved from a Google Code project.
Added by 2010-05-06T18:19:36.000Z by dmel...@gmail.com.
Please review that bug for more context and additional comments, but update this bug.
Closed (Fixed).

Original labels: Type-Enhancement, Priority-Medium, Component-Core, Milestone-0019

Original description

What change would like to see?

The additions of #define's or consts for the analog input pins. That is, A0 would have the value
14, A1 would be 15, etc. Then analogRead() would take either 0 or A0, 1 or A1, etc.

Why?

So we can do:

digitalWrite(A0, HIGH); // enable a pullup
analogRead(A0); // read from the pin

Or, potentially (if we add it):

pullup(A0);
analogRead(A0);

Would this cause any incompatibilities with previous versions? If so, how
can these be mitigated?

The analogRead() functions need an extra check to accept either 0 or A0, but I don't think it will
hurt anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions