Assistance with engineering project

I am an undergraduate MechE tasked with an industry based project and I'm looking for some help with an Arduino circuit that can connect some components and then display to the user the outcome.
The parameters of the project:
-to take 3 distance measurements using a sensor
-take the highest value and use that to check against a list of a values (which are ranges)
-display on a sevseg a number between 1 and 6 based on the value

Any help with mostly the coding side would be appreciated ,

Thanks

To even start we need particulars of the hardware. What Arduino? What distance sensor? What display?

Hello, this is a theoretical project so any components are available, but the uno seems like the best bet. I'm really just looking for help with code to to take the highest of some inputs and check against some memory to display a certain output

Distance - are we talking “atlas”, “tape-measure”, “ruler” or “micrometer”?

code to to take the highest of some inputs

Let’s say you have an array of measurements. This will obtain the highest measurement from the array.

float measurements[] = {1.23,2.34,3.45,4.56,3.14,2.22};
float maxMeasurement = 0;

void setup()
{
   Serial.begin(115200);
   for(int n = 0; n < sizeof(measurements) / sizeof(measurements[0]); n++)
   {
      if(measurements[n] > maxMeasurement)
      {
         maxMeasurement = measurements[n];
      }
   }
   Serial.println(maxMeasurement);
}

void loop()
{

}

The array reference.
The sizeof() reference.

check against some memory to display a certain output

Not sure what that means.

if you make a flow chart it would be to read each of 3 sensors.
determine the highest value, ignore the others
compare the highest to the pre-set ranges
report digit from 0 to 6 based on above.

since this is theoretical, does the program have to work ?
will you get sensors for this ?
are you allowed to pick and choose things ?

the ultrasonic sensors that measure distance from about 2cm to 400cm are common, cheap and have lots of references. ie: easy to use. resolution of something like 0.5cm

if you are after the the thickness of a plate of sheet metal, then fractions of a mm resolution would be needed.
much less frequently discussed and a bit harder.

you could use blocks or shoe boxes or some such as your obstacles.
I imagine a conveyor belt with envelopes, small boxes of candy, shoe boxes… etc

if you need the program to look like a beginner wrote it you could

read sensor1
read sensor2
read sensor3

if sensor1 > sensor2 then max_distance = sensor1 else max_distance=sensor2
if sensor3 > max_distance then max_distance = sensor3 // only change if higher

now you know the longest distance.

if max_distance < 0.1 then digit=0
if max_distance > 0.1 then digit=1
if max_distance > 3 then digit=2
if max_distance > 5 then digit=3
if max_distance > 7 then digit=4
if max_distance > 9 then digit=5
if max_distance > 11 then digit=6

display ( digit )

this crude way, the software would pick the largest of the 3 readings.
then change the value of ‘digit’ until the range is larger than the value.
then display the result

this is not an actual program, but a crude way to look at a basic way to do it.

the big fail here is that if this was an assembly line, and the sensors were above the line, the greater distance would be the smaller package. say, you mounted the sensor 1 meter over the line, then any reading over 1 meter would mean nothing there and yield 0

Tweste99:
I am an undergraduate MechE tasked with an industry based project

[...]

Any help with mostly the coding side would be appreciated ,

Who has given you this task? I suspect s/he expects YOU to do it. And I suspect your Tutor would have posted the question here if s/he want us to provide the answer. Would you hire an engineer who got his grades by getting internet people to do his homework?

On the other hand if you get stuck with a specific part of the project (for example how to interface an Arduino to a particular sensor) then I reckon asking for advice about that would be perfectly reasonable.

...R

Tweste99:
-display on a sevseg a number between 1 and 6 based on the value

Any help with mostly the coding side would be appreciated ,

Help brings help -- please help me by telling the type of your seven segment display device (CC-type or CA-type), and then I will help you to connect it with UNO for showing digit like 1, 2, 3, .. on it.

Who has given you this task? I suspect s/he expects YOU to do it. And I suspect your Tutor would have posted the question here if s/he want us to provide the answer. Would you hire an engineer who got his grades by getting internet people to do his homework?

On the other hand if you get stuck with a specific part of the project (for example how to interface an Arduino to a particular sensor) then I reckon asking for advice about that would be perfectly reasonable.

He is a student from mechanical discipline, and he should be welcomed to seek any help from the veterans who are dealing with systems.

GolamMostafa:
He is a student from mechanical discipline, and he should be welcomed to seek any help from the veterans who are dealing with systems.

What is your own response to my question "would you hire ... "

I clearly indicated that I am willing to help but not willing to do the project - which is what seems to be expected.

...R

dave-in-nj:
since this is theoretical, does the program have to work ?

Theoretically, yes

dave-in-nj:
if you need the program to look like a beginner wrote it...

I love this!

One thing that needs clarifying though (for whoever writes the code :wink: ) is the taking of the 3 readings. When does that happen? Is it 3 readings say a half-second apart, and that’s it for eternity? Or continuous readings say a half-second apart and you want the highest of the last 3 always? Or readings in “groups” of 3 where say the groups are a minute apart but in a group the readings are a half-second apart? Or?