Sunday, May 16, 2010

Task 55 - Data Logging with Array

int photocellPin = 0; // the cell and 10K pulldown are connected to a0
int photocellReading;// the analog reading from the analog resistor divider];
int mySamples[10];

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


for (int i=0; i <10; i++){
photocellReading = analogRead(photocellPin);
mySamples[i] = (photocellReading);
delay(500);
}

for (int i=0; i <10; i++){
Serial.print("Analog reading = ");
Serial.println(mySamples[i]);
}
}

void loop(){
}

No comments:

Post a Comment