Sunday, May 16, 2010

Task 56 - Data Logging to EEPROM

#include EEPROM.h
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];
int value;
int a = 0;



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


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

for (int i=0; i <10; i++){
value = EEPROM.read(a);

Serial.print(a);
Serial.print("\t");
Serial.print(value);
Serial.println();

a = a + 1;

if (a == 10){
a = 0;
delay(500);
}
}
}

void loop(){
}

No comments:

Post a Comment