Hi,
First of all I gotta say I am very new to microcontroller arduino programming, I am only familiar with CAD modeling and various simulation. Please teach me and correct me if I am wrong.
Currently, I am using ps2 library for my optical mouse (with MX8733) to retrive x- and y-coordinates. The sample programming is shown below:
#include <ps2.h>
PS2 mouse(6, 5);
void mouse_init()
{
mouse.write(0xff); // reset
mouse.read(); // ack byte
mouse.read(); // blank */
mouse.read(); // blank */
mouse.write(0xf0); // remote mode
mouse.read(); // ack
delayMicroseconds(100);
}
void setup()
{
Serial.begin(9600);
mouse_init();
}
void loop()
{
char mstat;
char mx;
char my;
mouse.write(0xeb); // give me data!
mouse.read(); // ignore ack
mstat = mouse.read();
mx = mouse.read();
my = mouse.read();
/* send the data back up /
Serial.print(mstat, BIN);
Serial.print("\tX=");
Serial.print(mx, DEC);
Serial.print("\tY=");
Serial.print(my, DEC);
Serial.println();
// delay(20); / twiddle */
}
HOWEVER, it stucks at 'mouse.write(0xff); //reset' and nothing is shown at the serial monitor, or some time (rarely) it shows status=1000 x=0 y=0. I feel like MX8733 is using different protocol, no? Anyway, I can't find any detailed datasheet regarding this sensor, only found this http://www.lizhiic.com/admin/Product20/MX8733_SPEC_V1_0.pdf. Ive also found that ADNS
-2620 is a more common mouse sensor after some time of googling.
So my question is, is ps2 library applicable to all types of optical navigation sensor including this MX8733? If not, any idea to still use this sensor? *because I have bought 2 of them and I don't want to waste my money by leaving them aside doing nothing.
Sincerely, all experts and professionals out there, please help
Jay