PWM Macros

I have a set of 3 potentiometers that can alter the pulse widths of 3 pulses coming out of the PWM output. However I want to perform a sequence manually using the pots, record the values on the arduino, so that later I can implement a PTM switch or something else suitable to cause an interrupt and the program to perform this prerecorded PWM pattern.

I believe the duelimanove only has 512bytes of EEPROM, so this will not last long. I need around 50 values for each pot a second.

Im wondering what memory I can use to do this, originally I envisioned just doing a txt file and then reading in line by line when performing the sequence. Would it be possible to use FLASH memory for this and how would I go about doing it?

THanks for any help

You could use flash memory to store your results or better still some external I2C EEPROM:-

OK so if I read in the pot values, and save it in FLASH, one number after another, or 3 values per line, or any other way, can I then read this from a computer? Then all I have to do is compile it each time?

You can only read it from a computer if you have your sketch print it out in responce to a command from the computer. I don't get the compiling it again thing?


What I mean is I probably will want to look at the data that has been logged in FLASH before I rewrite the program to read it in and process it correctly, and once Ive done this, would I be able to compile it as a separate data file and get the main code to read it in and process it? Similar to how in C you can just do:

FILE *file;                 // file pointer
file = fopen("file.txt","r");    // open file
fscanf(file,"%x",&r);        // read in first hex value in txt file into variable r
fscanf(file,"%x",&a);       // read in first hex value in txt file into variable a

and loop this as many times as needed until EOF

Basically no, there is no concept of a file in the arduino. I think if you want to include any recording in an arduino sketch you are better off doing the recording on the PC using something like processing. With that you could generate a file from measurements taken from the arduino. Review then and then incorporate them into an arduino sketch as flash bases array. This playback sketch would then read this array.