Pages: [1]   Go Down
Author Topic: How to scan and get min and max value for analog sensor  (Read 955 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-confuse.

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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26495
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey, that was quick! smiley 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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26495
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"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.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26495
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
Logged

Pages: [1]   Go Up
Jump to: