convert vector/array to an integer

Hi,

im planning a program that uses several (~ 16 input D channels) digital input channels and uses if slopes to identify what to do.
I thought about reading all inputs at the beginning and then creating a digital string (for example 10100100101100) to decide the case. So the length is always the same... start will be 0000000... . I am new to arduino and so far i can create the vector / array and write the inputs in there. But i dont know how to convert the vector
for example
int DV[] = {0,0,0};
into a string
000

Or is there a better way to do this?
I have also some cases where i want to use an analog input in addition
for example 101 and AnalogIn <=500 or something like that.

Thanks in advance

Something like this (code not tested)

int DV[] = {0,0,0};

void setup()
{
  Serial.begin(115200);
  Serial.writeln("Start");

  for (int i=0; i< 3; i++)
  {
    Serial.write(DV[i]);
    Serial.write(",");  // the comma is a separator to make interpreting on the other side easier.
  }
  Serial.writeln();
}

void loop(){}  // loop is empty

Thanks for your answer... but thats not what i wanted to do...

In case anyone else is interested yout can do that with string concatenation

int DV[] = {0,0,0,0}; // vector that holds the inputs
String SDV; // string that will be generated from DV

in void setup you can create the vector and the string

void setup() {
Serial.begin(9600);

//create vector
for (int i=0; i <= 3; i++){
TempVal=digitalRead(Dchans*);*

  • if (TempVal==HIGH){*
    _ DV*=1;_
    _
    }_
    _ SDV=SDV+DV; // string to compare*
    * }*_

}
Thanks anyway

but thats not what i wanted to do

Then, you need to clarify what it is you want to do.

A char array would be better than a String. You can easily store a '0' or a '1' in the array when digitalRead() returns a HIGH or LOW.

char arr[8];

arr[n] = digitalRead(pin[n]) + '0';

No way should you use a String to hold that data. Use a byte array, or use an unsigned int with 1 bit per input (if there are no more than 16 inputs), or an unsigned long with 1 bit per input (if there are no more than 32 inputs). Something like this:

  unsigned int readings = 0;
  for (int i=0; i <= 3; i++)
  {
    readings <<= 1;
    TempVal=digitalRead(Dchans[i]);
     if (TempVal==HIGH)
     {
       readings |= 1;
     }
  }

  ...
  if (readings = B00000101) ...