cannot convert 'String' to 'uint8_t

now = digitalRead(sNames*); throws a compile error:*
garageTest:44: error: cannot convert ‘String’ to ‘uint8_t {aka unsigned char}’ for argument ‘1’ to ‘int digitalRead(uint8_t)’
OK. I am not happy. I am not asking to convert types for gosh sakes!! I want a boolean value from d’r’d of sNames of the ith array row. Here is code. I am not experianced with Arrays, but there isn’t any other clean way to do the same thing to a number of items. The code of course is incomplete. I run verify every few lines, I always am missing semi-freakin’-colons.
```
*byte sdbr = 3; // South Door Bolt Reed
byte sdr = 4; // South Door Open Reed
byte smo = 5; // South Magnet On (12V, so setup voltage div network)
byte smg = A1; // South Magnet Green (look for 3.08V. Use voltage divider)
byte smt = 6; // South Magnet Trigger / Unlock
byte smpex = 7; // South Magnet PEX NC
byte smc = 8; // South Magnet Contact
byte swr = 9; // South Window Reed
byte kp = 10; // Kitchen PIR
byte g4r = 11; // G4 Reed
byte str = 12; // Strobe Light IF
byte g4 = A0; // Garage 4 Clicker Button IF

String sNames[14];
boolean was[14];
boolean ms[14];
boolean now[14];
int i;

void g4button() {
  /*
    Rule:
    IF the light is green and a reed on window is hit, trigger.
  */
  digitalWrite(g4, HIGH);
  delay(100);
  digitalWrite(g4, LOW);
}
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(A0, OUTPUT);
  String sNames[9] = { “sdr”, “sdbr”, “smo”, “smg”, “smt”, “smc”, “swr”, “kp”, “g4r” };
}

void loop() {
  // put your main code here, to run repeatedly:

// Detect state changes
  for (i = 0; 0 < 12; i++) {
    now[i] = digitalRead(sNames[i]); // Set current state
    if (now[i] != was[i]) {  // ** Change in state ? **
      ms[i] = millis; // Set the time
      int way = (now[i] * 2) + (was[i] * 1); // 0 Lo>Lo, 1 Hi>lo, 2 Lo>Hi, 3 Hi>Hi
      if (way = 1) Serial.println(sNames[i] + String(way));
    }
    // Set new states
  }
}
_
```*_

I fixxed some stuff like the 0 < 12 in the for init, still can’t get by that darn error.

String sNames[14];

sNames is a String

 String sNames[9] = { "sdr", "sdbr", "smo", "smg", "smt", "smc", "swr", "kp", "g4r" };

in fact you have 2 different String variables with the same names but different scopes

   now[i] = digitalRead(sNames[i]); // Set current state

The error occurs because you try to use a String as the parameter to digitalRead().

Thanks, Piloting a Chopper isn’t easy. Even RC. Too much hair in my place…

Strings confuse me in C++. I’m not trying to break law for using them. An array makes me shudder because I know a single string is a mem hog. I would use a char array IF I wasn’t trying to use it in another array. I have already moved up and put the sNames all the way at top at the first declaration. Still it busts. I gave up and cycle pin numbers…

So the names of the pins are Strings, as they are mapped out up top, naturally, even the native pin names, ie: “A0”, that’s a damned string. I got it working prior. I mis-typed something!

byte sdbr = 3; // South Door Bolt Reed
byte sdr = 4; // South Door Open Reed
byte smo = 5; // South Magnet On (12V, so setup voltage div network)
byte smg = A1; // South Magnet Green (look for 3.08V. Use voltage divider)
byte smt = 6; // South Magnet Trigger / Unlock
byte smpex = 7; // South Magnet PEX NC
byte smc = 8; // South Magnet Contact
byte swr = 9; // South Window Reed
byte kp = 10; // Kitchen PIR
byte g4r = 11; // G4 Reed
byte str = 12; // Strobe Light IF
byte g4 = A0; // Garage 4 Clicker Button IF

String ssNames[12] = { "sdr", "sdbr", "smo", "smg", "smt", "smc", "swr", "kp", "g4r" };
boolean was[14];
boolean ms[14];
boolean now[14];
int i;


void g4button() {
  /*
     Rule:
     IF the light is green and a reed on window is hit, trigger.
  */
  digitalWrite(g4, HIGH);
  delay(100);
  digitalWrite(g4, LOW);
}
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(A0, OUTPUT);
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
  pinMode(6, OUTPUT);
  pinMode(7, INPUT_PULLUP);
  pinMode(8, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);
  pinMode(10, INPUT);
  pinMode(11, INPUT_PULLUP);
  pinMode(12, INPUT_PULLUP);
  pinMode(13, OUTPUT);
  pinMode(A0, OUTPUT);
  pinMode(A1, INPUT);

}

void loop() {
  // put your main code here, to run repeatedly:

  // Detect state changes
  for (i = 0; i < 12; i++) {
    String sName = ssNames[i];
    now[i] = digitalRead(sName); // Set current state
    delay(100);
    if (now[i] != was[i]) {  // ** Change in state ? **
      ms[i] = millis; // Set the time
      int way = (now[i] * 2) + (was[i] * 1); // 0 Lo>Lo, 1 Hi>lo, 2 Lo>Hi, 3 Hi>Hi
      if (way = 1) Serial.println(ssNames[i] + String(way));
      was[i] = now[i];
    }
    // Set new states
    int dur = millis - ms[i];
    Serial.println(ssNames[i] + "Has been steady for: " + String(dur / 1000) + "secs");
  }
}

Why does digitalRead "want" a int? "A1" is NOT an Integer!

"A1" is NOT an Integer!

Yes it is. In the file pins_arduino.h the lines

#define PIN_A1   (15)
static const uint8_t A1 = PIN_A1;

clearly makes A1 a uint8_t (byte) data type.

A byte is an integer (but not an int).

mattlogue:
Why does digitalRead “want” a int? “A1” is NOT an Integer!

Just as a test, try printing A1 (no quotes). What do you see ?

For extra fun try

  for (int pin = A1; pin <= A5; pin++)
  {
    Serial.println(pin);
  }
String sNames[9] = { "sdr", "sdbr",

I notice that your Strings are all the same as your variable names. You're not hoping that you can stick a String with the value "sdr" and it's going to recognize that is a variable with the value 4 are you? That ain't gonna happen. Variable names are long gone by the time the code starts running. The compiler gets rid of all the names and uses memory addresses. There is no PIN number "sdr". All the pins have numbers. You have to use the number.