I am using a ir-temp sensor which contains 64 ir-sensors alligned in a 8x8 array. The sketch returns a array of 64 double-values. Visually the array is easier to read if I just print int to the serial monitor and add a linebreak after 8th reading so that it look like a 8x8 array in the serial monitor.
But how difficult is it to "track" the highest value as it travels from one side to the other?
I would like to be able to drag my hand past the sensor and have some printout when my hand goes from one side to the other.
I find it very difficult to even understand where to begin if I for example tried to "track" the highest value in the simple example below. What kind of methods is needed to have this return a "someone moved to the left" message from analyzing the array? Also the real array is just a array of length 64 which makes it more hard to get a grip of to me.
What kind of methods is needed to have this return a "someone moved to the left" message from analyzing the array?
The field of study this calls on is called pattern recognition and is a thing that is easy for you to do but hard for a computer. Therefore it is hard to program this to get what you would consider a good result.
What you need to do is to find the X-Y values for the "hot spot". If you have a liner array representing your physical two dimensional array you need to know how it is made up in order to come up with a way of converting the linear array value into an X-Y pair. This is the inverse of what you have to do when making an LED matrix from an addressable strip.
So suppose your array has the first 8 elements along the bottom row then the X coordinate is simply the remainder of the sensor number divided by 8 ( this is called the mod and the symbol for this is % ) and the Y coordinate is the integer result of dividing the sensor number divided by 8.
So find the hot spot coordinate pair and store it. Then scan again and find the new coordinate pair. Then you subtract one pair from the other to find the delta ( or difference ) between the two. If their has been sufficient change in say the X direction you can then output a message saying "Moved to the Left" or "Moved up".