How to scan and get min and max value for analog sensor

Hello!

I would like to scan with servo motor from one to another point. While scanning I would like to read analog input. After scanning finished I would like to get min and max values of analog sensor. Analog sensor will be photocell. I have Arduino MEGA 2560. All I know is that Arduino have some memory to save data and that is all :~.

Are there any other options to save data or just simply get min and max value? Can somebody inform me how to do it? How many options are there to get these value?

Be good,

Andrej Z.

Take a reading.
Compare it with your previous biggest reading.
Is it bigger? Yes, so store it.
Compare it against your previous smallest reading.
Is it smaller? Yes, so store it.
Store the position where you read it too, if you want.

Hey, that was quick! :slight_smile: Thank you a lot! Is there function how to store value? Is this the easiest way to store data?

Are there any other ways to store data? Do you maybe know anythink about storing data in Arduino built-in memory?

Be good! And thanks again!

Andrej Z.

"store a value" is a simple assignment in C, unless you need to store values across power-downs (which you haven't made clear), so I can't tell if you're simply over thinking this problem.

First sorry for so late answer.

I understand your point. Sorry for stupid questions but I don't have so much experience with storing data on Arduino and I don't know how many options is there for saving data. When I browse for storing a value on Google, I get a lot of resoults about EEPROM. Are there any easiest way to store data, maybe like you suggest on first replay?

I don't need to store data when is turned on.

Thank you!

Regards,

Andrej Z.

I really don't know what you're asking.int Val = analog read(0); is an assignment, and stores a reading in a variable called "Val"

Sorry, but I meant that is more difficult. Thank you to better and easier understanding of rpogramming language

I meant more about options like saving on SD card, EEPROM, differences between them and what programming commands ??exist

I didn't mean that is so simple commands that you wrote :slight_smile: