Sorry my mistake!!!The whole code is:
#include <EEPROM.h>
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
int sensorValue = 0; // value read from the pot
int outputValue = 0; // value output to the PWM (analog out)
int storeData[10];
int cData = 0;
//----------------------------------------------------------------------------------------
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
Serial.print("Units to Volts\n");
Serial.print("-------------------------------\n");
}
//----------------------------------------------------------------------------------------
void loop()
{
if( cData <= 10 ){
// read the analog in value:
sensorValue = analogRead(analogInPin);
// change the analog out value:
analogWrite(analogOutPin, sensorValue);
//write these 10 values to eeprom
EEPROM.write(cData, sensorValue);
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(((sensorValue*5.0)/1024),4); //output result into volts
//with 4 digits precision
// wait 10 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
cData++;
delay(10);
}
byte serialData = Serial.read();
//Serial.println("Press l to load values from eeprom");
if ((char)serialData =='l') {
int addr = 0;
while (addr <= 10) {
// read a byte from the current address of the EEPROM
byte value = EEPROM.read( addr );
Serial.print( addr );
Serial.print("\t");
Serial.print(value, DEC);
Serial.println();
addr++;
}
}
}// ...loop()
//----------------------------------------------------------------------------------------
Thanks!!