Analog input in array

Hi, I am trying to read analog input values, coming from a potentio-meter, and store these in an array that has to be sent to Flash.
I want to read the values from the pot-meter every 2 seconds, and then store these in an array. The array needs to contain 32 characters in the end. I have written the following code so far:

int sensorPin = 2; // input pin for the potentio meter
int val = 0; // variable to store input from sensor
int i;

int myArray[33]; // the array with 33 characters, no initialization

void setup(){
Serial.begin(9600); // open serial port
}

void loop(){
val = analogRead(sensorPin);
for (val = 0; val < 33; val = val+1){
Serial.println(myArray[val]);
}

delay (2000);
}

This doesn't seem to work... I don't know how to solve this, so it would be great to get some help :slight_smile:
Thanks so much!

hi

val = analogRead(sensorPin);  
  for (val = 0; val < 33; val = val+1){
  Serial.println(myArray[val]);
  }

in the code above, the for loop only tells Serial.println to print the array values. You don't have any code for string the values... You need a loop before the one above, for storing the values before you attempt to read it. Also, the val=0; val<33 etc should just be i, j or k or something similar, as
the integer "val" is actually the value read from the analog port, not the integer keeping track of the loop state.

D