Skip to main content
added 16 characters in body
Source Link

I know this is old, but if you hover your mouse over A0 to A7 in visual micro it will show you the true value, they are just a variable (it actually shows as 14U but while addressing you do not need to include the U). What Craig said is wrong, they do NOT have to be addressed by A0, A1 ect..

A0 = 14 A1 = 15 . . A7 = 21

//Will set all pins, digital and analog to LOW (0)
for (int i = 1; i < 22; i++) {
    digitalWrite(i, LOW);
}

//Will set all analog pins to LOW (0)
for (int i = 14; i < 22; i++) {
    digitalWrite(i, LOW);
}

//Will set all analog pins to LOW (0)
for (int i = A0; i < A7 + 1; i++) {
    digitalWrite(i, LOW);
}

The last for loop is basically saying i = 1 (A0), and stop on 21 (A7).

I know this is old, but if you hover your mouse over A0 to A7 it will show you the true value, they are just a variable (it actually shows as 14U but while addressing you do not need to include the U). What Craig said is wrong, they do NOT have to be addressed by A0, A1 ect..

A0 = 14 A1 = 15 . . A7 = 21

//Will set all pins, digital and analog to LOW (0)
for (int i = 1; i < 22; i++) {
    digitalWrite(i, LOW);
}

//Will set all analog pins to LOW (0)
for (int i = 14; i < 22; i++) {
    digitalWrite(i, LOW);
}

//Will set all analog pins to LOW (0)
for (int i = A0; i < A7 + 1; i++) {
    digitalWrite(i, LOW);
}

The last for loop is basically saying i = 1 (A0), and stop on 21 (A7).

I know this is old, but if you hover your mouse over A0 to A7 in visual micro it will show you the true value, they are just a variable (it actually shows as 14U but while addressing you do not need to include the U). What Craig said is wrong, they do NOT have to be addressed by A0, A1 ect..

A0 = 14 A1 = 15 . . A7 = 21

//Will set all pins, digital and analog to LOW (0)
for (int i = 1; i < 22; i++) {
    digitalWrite(i, LOW);
}

//Will set all analog pins to LOW (0)
for (int i = 14; i < 22; i++) {
    digitalWrite(i, LOW);
}

//Will set all analog pins to LOW (0)
for (int i = A0; i < A7 + 1; i++) {
    digitalWrite(i, LOW);
}

The last for loop is basically saying i = 1 (A0), and stop on 21 (A7).

Source Link

I know this is old, but if you hover your mouse over A0 to A7 it will show you the true value, they are just a variable (it actually shows as 14U but while addressing you do not need to include the U). What Craig said is wrong, they do NOT have to be addressed by A0, A1 ect..

A0 = 14 A1 = 15 . . A7 = 21

//Will set all pins, digital and analog to LOW (0)
for (int i = 1; i < 22; i++) {
    digitalWrite(i, LOW);
}

//Will set all analog pins to LOW (0)
for (int i = 14; i < 22; i++) {
    digitalWrite(i, LOW);
}

//Will set all analog pins to LOW (0)
for (int i = A0; i < A7 + 1; i++) {
    digitalWrite(i, LOW);
}

The last for loop is basically saying i = 1 (A0), and stop on 21 (A7).