Lab #4: Non-volatile memory, Servo Motors and MATLAB
Build a data-logger with a photoresister Below is our code for the data logger with a photoresistor: #include <EEPROM.h> int pin = A0; int index = 0; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(pin,INPUT); Serial.println("Input 'W' to write data into EEPROM. Input 'R' to read data."); } void loop() { // put your main code here, to run repeatedly: char inputChar = Serial.read(); if (inputChar == 'W'){ for(index; index <13; index ++){ int data = analogRead(pin); EEPROM.write(index, data); index ++; delay(5000); } index = 0; }else if (inputChar == 'R'){ int i = 0; while (i <13){ int value = EEPROM.read(i); ...