109Views1Replies

# Using the Eyewriter to control other devices. How can I find the x,y coordinates and use them for other applications? Answered

I built the eyewriter about 6 months ago and it all seems to be working fine. It is an awesome project with a huge number of potential applications.

I want to use the signal from the eyewriter (the X,Y coordinates) to control an audio signal, but I am quite new to code and am struggling with how to go about this task.

The rough diagram shows what I am trying to do. The idea is to have the cursor move around a screen controlled by the viewers's eye movements. When they look at different images on the screen, it would play the sound of that image. For example if they look at section 2 of the screen they would hear the sound recording of the plane, if they look at section 8 they would hear the sound recording of the dog barking, and so on.

I think this should be quite easy to do by messing around with the eyewriter code. I wonder if anyone has any ideas or advice?

Please check out my instructables to see what i'm up to!

Many thanks!

Tags:

The forums are retiring in 2021 and are now closed for new topics and comments.

Create a 2 dimensional array to an index that tells you what sound to play. I think this works in Arduino
int[][] myArray = { {0,1,2,3}, {4,5,6,7} };
(The 0..7 is the index you need to select your music)

Let the X coordinates range from 0 to Xmax
Let the Y coordinates range from 0 to Ymax.
Let the number of boxes in the X direction be Xbox
Let the number of boxes in the Y direction be Ybox
Let the current coordinate be X and Y
To divide up the coordinate space into little boxes, with result Xindex and Yindex do this:
Xindex= Xbox * X / Xrange
Yindex= Ybox * Y / Yrange
Now you have the values you need to get data from the array musicchannel = myarray[Xbox][Ybox]

If you're want to be REALLY cunning, then try and scale X range and Y range to be multiples of 2, like 1024 and 512...
Xrange =1024
Yrange=512
Then you can do
Xindex = Xbox * X << 10
Yindex= Ybox * Y << 9 ...
which takes less code and runs faster.