I am trying the take readings from four analog inputs and order them by size. I thought of using a struture as that way i can assign the value read to one variable and also a unique value to another variable corrisponding the the input.
That way when i sort the values into order of size i wont loose which value came from where.
In the grand scheme of things i am trying to make a robot that will detect sound and move towards it, the alalgo inputs are connected to mics that are positioned 90 degrees out from each other around the robot, i want to use the highest reading to tell the robot which direction to go however i also want the robot to detect if the sound is half way between to mics, i.e. there two values are nearly the same.
so basicly the code would go;
copy values to struct,
sort struct the decending order,
look at block zero and block 1 and if there within say 100 of eachother and the mics are next to eachother then sound is between them,
else sound is infront of highest.
My problem is i cant get a structure defined and also i dont know how to sort efficently, please can someone help?