This statement follows an if conditional statement. That's why the curly braces at begin and end. Array has been pre declared setting it to 255. voltsarray[255]=0.. Array has been pre zero'd. So voltsarray[0] = 0. What am I missing pse. Say count = 0
{voltsarray[] = {count}};
I can post the if statement if necessary. This line immediately follows the if.
voltage = analogRead( A0 ); // Read the voltage from the filter board Pin A0
if (( voltage <= 255 ) && (count <= 255))
{voltsarray[] = {count}
else {count= count + 1}
// voltsarray is the array. store voltage to array 0
{ //if count less than or equal to max array count 255
count = count + 1;
} // count is equal to count +1 so counter for array is now 1
else if (count >= 255)
{ //if count is greater than 255 then array is full
count = 0;
} //so array is full set counter to 0 get ready to analyze the array
delay(10);
// print total count to terminal. should be 255
//count can be changed to voltage to see input from A0 pin
I don't understand missing some and?
The other code compiles and runs correctly. the section to zero the array does work fine. It is used in case the array occupied space might have a byte accidently. Also much more code follows this. This more or less an introduction with many things to follow. How do you indent? The tab feature doesn't work.
int voltage = 0;
int count = 0;
const int b = 255;
int voltsarray[b];
int analogValue = 0;
int x = 0;
void setup()
{
Serial.begin(9600);
for(int j=0;j<=255;j++)
voltsarray[j] = 0;
}
void loop()
{
x = 0
voltage = analogRead( A0 ); // Read the voltage from the filter board Pin A0
if (( voltage <= 255 ) && (count <= 255))
{
voltsarray[x] = voltage //]This is the problem line
] }
else
{count = count +1}
}
x = x+1;
// voltsarray is the array. store voltage to array 0
//if count less than or equal to max array count 255
if count >= 255
{
count = 0
}
//so array is full set counter to 0 get ready to analyze the array
delay(10);
// print total count to terminal. should be 255
//count can be changed to voltage to see input from A0 pin while reading 255 times
Serial.println(voltage);//test
}
This statement follows an if conditional statement. That's why the curly braces at begin and end. Array has been pre declared setting it to 255. voltsarray[255]=0.. Array has been pre zero'd. So voltsarray[0] = 0. What am I missing pse. Say count = 0
As for tags, all of mine are expired and I don't want to get arrested. As for changing the code to html, I did and it didn't show up here. I would post again but my post hole digger is out of gas. As for my question it again goes unanswered. I suppose Ill write the code in a different way. .. I cant say thanks because everything is always addressed except for the problem.
Instead of wasting your time and ours writing random nonsensical garbage, get an elementary c/c++ textbook and learn to get the basic language syntax right.
Maybe some examples would help. See if you can follow this:
byte pinsArray[] = {13,14,15,16,}; // 4 element array
int analogArray[256]; // array of 256 ints = 512 bytes
byte x; // use for a counter
void setup(){
pinMode (pinsArray[0],OUTPUT); // set D13 as output
Serial.begin(9600);
digitalWrite (pinsArray[0], HIGH); // turns on D13
delay (1000);
digitalWrite (pinsArray[0], LOW); // turns off D13
}
void loop(){
// take 256 readings, every 0.1 second
for (x=0; x<=255; x=x+1){
analogArray[x] = analogRead(A0); // take a reading and store it in the array.
delay (100);
}
for (x=0; x<=255; x=x+1){
Serial.print ("location ");
Serial.print (x); // print out the array element to be read
Serial.print ("value ");
Serial.println (analogArray[x]); // [print out the data at array location x
}
} // end loop
stx38834:
As for tags, all of mine are expired and I don't want to get arrested. As for changing the code to html, I did and it didn't show up here. I would post again but my post hole digger is out of gas.
Meaningless mumbo-jumbo.
As for my question it again goes unanswered. I suppose Ill write the code in a different way. .. I cant say thanks because everything is always addressed except for the problem.
We seem to be in a parallel universe. You post nonsense, we try to help you, you post more nonsense.
stx38834:
As for tags, all of mine are expired and I don't want to get arrested.
You got told you use the tags. When you did that, people started looking at your code.
As for my question it again goes unanswered.
That's because people are giving you what you need, not what you want.
So let's try to address your actual question:
What am I missing pse
You are missing that braces are used to delimit a statement list so that syntactically it become a single statement. You have put braces inside an assignment expression, which is nonsense and means nothing and will not compile.
stat
-> compound-stat
-> '{' stat-list '}' (there's your first pair of braces)
-> stat
-> exp_stat
-> exp ';' (here's your first error. No semicolon terminating the expression.)
-> assignment_exp
-> unary_exp assignment_operator assignment_exp
--> unary_exp is voltsarray[], (Here's your second error. No expression in the brackets.)
--> assignment_operator is '='
--> assignment_exp you are trying to have as {count}, which just makes no sense whatever.
Did you understand that?
Of course not. That's why people have not been answering your question - it's obvious that you would not understand the answer. Instead they have been trying to help you. Maybe you should read that link.