Thursday, June 3, 2010

Task 59 - Data Logging of Light Over 24 Hours

I found this was not very accurate as EEPROM was not storing numbers correctly. If a number was over 300 it would not save it into EEPROM, but would save another number all together. However These are my results





#include
int photocellPin = 0; // the cell and 10K pulldown are connected to a0
int photocellReading; // the analog reading from the analog resistor divider
int value;
int a = 0;



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


for (int i=0; i <25; i++){
photocellReading = analogRead(photocellPin);
Serial.print("Analog reading = ");
Serial.println(photocellReading);
EEPROM.write(i, photocellReading);
delay(3600000);

value = EEPROM.read(i);

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



}


for (int i=0; i <25; i++){

value = EEPROM.read(i);

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



}
}

void loop(){

}

Graphed Results (Analog Results, not ones stored in EEPROM):

No comments:

Post a Comment