[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recommendations for a response box with a knob

Hi Brian,
If you want ultra cheap, then you can use the scroll wheel on a USB mouse. Matlab can capture scrolling events and update a variable if you include a WindowScrollWheelFcn function in your code:

function dial_plotter_example
global dial_value
dial_value = 0;
h = figure; set(h,'WindowScrollWheelFcn',@figScroll)

while ishandle(h),
    scatter(dial_value,0,'filled'); axis([-10 10 -10 10]);

function figScroll(src,evnt)
global dial_value
dial_value = dial_value + evnt.VerticalScrollCount;

We went as far as to disassemble the mouse and stick it in a nice project box. We rewired the 3 mouse buttons to buttons on the top, mounted the scroll wheel encoder vertically underneath the lid, and attached a big appealing dial on top. Presto! a 3-button box with a dial and a remarkably low latency response - and how much does a USB mouse cost?

all the best,

ps. this will not work in older versions of Matlab. I don't remember in which version WindowScrollWheelFcn was added. It doesn't work in r14.


W. Owen Brimijoin
MRC Institute of Hearing Research
Scottish Section
Glasgow Royal Infirmary
Glasgow, United Kingdom