How to create this Photometer System

Hello koders, i need help about how to create this system for my Photometer app.unnamed

I don’t understand what you are trying to make.
Are you talking about the UI design?

1 Like

Light Sensor component ?
https://docs.kodular.io/components/sensors/light-sensor/

1 Like

I want to be able to automatically save the parameters obtained from the sensor.

I have already set up the component, now I need to create an automatic saving system of the parameters obtained from the sensor (min.avg.max.)

Database local ?
Tinydb or Sqlite.
What do You Want save ? Min And Max ?
When do You Want save It ?
:thumbsup:

TinyDB. I would like the parameters min. and max. it will update every time the sensor detects changes.

Will the values overlap?
Can you explain to me, how will you use these values stored on the smartphone? What will the user use these stored values for? :thumbsup:

Yes, the values ​​will overlap each time the light sensor detects a change.

I didn’t understand the use of showing this in an app.
But then you don’t have to write to a database. Use variables.
And the minimum and maximum values? How are they created?
Does the sensor measure x and compare to see if it is the minimum or the maximum?

Maybe , in This Event :

if illuminance> max
max = illuminance
else
if illuminance<min
min = illuminance

average = (max + min) / 2

1 Like

All the values ​​come from zero and when the sensor detected for example “60”, this parameter is saved on max and if there is a variation of illumination that does not exceed 60, it is saved on min. If with another variation the sensor detects 63, the max parameter is updated with 63.

Start with 0 Max , 0 min
On light Change

if illuminance> max
max = illuminance
else
if illuminance<min
min = illuminance

average = (max + min) / 2

1 Like this?

1 Like

The idea I suggested will change according to your idea.
Two variations 60 and 63:
the first time, it will be max and min (and this algorithm that I showed you, will not work)
You will have to change, because in the first changes the 2 values, mandatorily will be the maximum and the minimum.
And what I suggested will not work.
I just passed on the initial idea for you to develop and improve.

Try , You will get it :+1:

1 Like

And min ? Understood ? will it continue with a value of 0? :wink:

Use > , instead >=
Use < , instead <=

Or no ?

1 Like

The “max” parameter continues to update, even if the value decreases instead of saving the highest value, while “min” always remains on 0. I think I’m doing something wrong. :sweat_smile:
Thanks all the same for your time and help. :+1:

1 Like

So, I gave you the start of the algorithm. :thumbsup:

Now, you will win your challenge. :thumbsup:

Try yourself ! :clap:

1 Like