Creating a paper touch pad
hey guys,
a few years ago posted demo on youtube "paper trackpad" alternative laptop mouse (see here
). particular project uses arduino microcontroller. unfortunately, unable schematics creator because post old however, did find diagram of circuit. ((see here
)
in video description, person has posted code.
int a, b, c, d, x, y, xout, yout, i;
int xbuffer[10];
int ybuffer[10];
void setup() {
analogreference(default);
serial.begin(9600);
}
void loop() {
//read 4 corners
= analogread(0);
b = analogread(1);
c = analogread(2);
d = analogread(3);
//
x = (2.0663707*c + 2.0544114*a - 1.1423724*b - 1.5299211*d - 1266.8639) / 1.5; //do x magic
y = (2.6366761*b + 3.5104709*a - 0.41156325*c - 1.3292001*d - 3814.8667) / 1.5; //do y magic
//(the above formulas derived properties of piece of paper + graphite , won't work other)
//buffering stuff smooth mouse motion
xbuffer[0] = x;
ybuffer[0] = y;
xout = 0;
yout = 0;
for(i=0; i<9; i++)
{
xout = xout + xbuffer;
yout = yout + ybuffer;
}
xout = xout / 10;
yout = yout / 10;
for(i=1; i<9; i++)
{
xbuffer = xbuffer[i-1];
ybuffer = ybuffer[i-1];
}
//end of buffering
//send x y positions computer. program of own required receive , interpret mouse movement.
serial.print("x");
serial.print(xout);
delay(25);
serial.print("y");
serial.print(yout);
serial.print("e");
delay(25);
}
i have tried run code past 3 days , seem fail each time. in code, person has written function x , y coordinates. did experimentation myself analog write values derive equation (it failed). stuck , can't figure out do. also, using c# change coordinates mouse.
can please offer guidance?
this link original project.
a few years ago posted demo on youtube "paper trackpad" alternative laptop mouse (see here
in video description, person has posted code.
int a, b, c, d, x, y, xout, yout, i;
int xbuffer[10];
int ybuffer[10];
void setup() {
analogreference(default);
serial.begin(9600);
}
void loop() {
//read 4 corners
= analogread(0);
b = analogread(1);
c = analogread(2);
d = analogread(3);
//
x = (2.0663707*c + 2.0544114*a - 1.1423724*b - 1.5299211*d - 1266.8639) / 1.5; //do x magic
y = (2.6366761*b + 3.5104709*a - 0.41156325*c - 1.3292001*d - 3814.8667) / 1.5; //do y magic
//(the above formulas derived properties of piece of paper + graphite , won't work other)
//buffering stuff smooth mouse motion
xbuffer[0] = x;
ybuffer[0] = y;
xout = 0;
yout = 0;
for(i=0; i<9; i++)
{
xout = xout + xbuffer;
yout = yout + ybuffer;
}
xout = xout / 10;
yout = yout / 10;
for(i=1; i<9; i++)
{
xbuffer = xbuffer[i-1];
ybuffer = ybuffer[i-1];
}
//end of buffering
//send x y positions computer. program of own required receive , interpret mouse movement.
serial.print("x");
serial.print(xout);
delay(25);
serial.print("y");
serial.print(yout);
serial.print("e");
delay(25);
}
i have tried run code past 3 days , seem fail each time. in code, person has written function x , y coordinates. did experimentation myself analog write values derive equation (it failed). stuck , can't figure out do. also, using c# change coordinates mouse.
can please offer guidance?
this link original project.
how did study tutorials on analog use in arduino? how about: https://www.arduino.cc/en/tutorial/analoginput. might find answers here.
paul
paul
Arduino Forum > Topics > Device Hacking > Creating a paper touch pad
arduino
Comments
Post a Comment