I have what is probably a very simple question.
How do I print out an array as a whole? What I mean is that I have 8 inputs and I want to print out all 8 together at the end of the while loop?
Here is what I got.
int r0 = 0; //value select pin at the 4051 (s0)
int r1 = 0; //value select pin at the 4051 (s1)
int r2 = 0; //value select pin at the 4051 (s2)
int row = 0; // storeing the bin code
int count = 0; // just a count
int bin [] = {000, 001, 10, 11, 100, 101, 110, 111};
int a1=0;
int b2=0;
int c3=0;
int d4=0;
int e5=0;
int f6=0;
int g7=0;
int h8=0;
int anaR [] = {a1, b2, c3, d4, e5, f6, g7, h8}; //read inputs
int anaSave [] = {a1, b2, c3, d4, e5, f6, g7, h8}; //store input
void setup()
{
pinMode(0, INPUT);
pinMode(22, OUTPUT); // s0
pinMode(23, OUTPUT); // s1
pinMode(24, OUTPUT); // s2
Serial.begin (9600);
}
void loop ()
{
while (count <8 )
{
row = bin[count];
r0 = row & 0x01;
r1 = (row>>1) & 0x01;
r2 = (row>>2) & 0x01;
digitalWrite(22, r0);
digitalWrite(23, r1);
digitalWrite(24, r2);
anaSave[count] =analogRead(anaR[count]);
Serial.print("Here it comes ");
Serial.println(anaSave[count]);
delay (1000);
count++;
}
Serial.print("One output of all inputs is ");
Serial.println(anaSave[a1, b2, c3, d4, e5, f6, g7, h8]); // array output of all inputs together
count=0;
}
Thanks