Go Down

Topic: Interfacing with a PS/2 Pointing stick using Pro Micro (Read 121 times) previous topic - next topic

Laffinm

Hello Everyone!

I am currently trying to finish up a semester engineering project (presenting in 5 days), and I have run into an issue. My project involves a computer mouse that is built into a plastic retainer so that a person without use of their arms can operate a computer mouse with their tongue and jaw muscles. The main component of the device is an old pointing stick module ripped from a laptop keyboard, and it operates on PS/2 protocol.

At the bare minimum, I am trying to read basic values from the device using a library such as PS2Mouse.h

For connections, I have CLK going to pin 9, DATA going to pin 3, and VCC and GND going to their respective ports on the arduino board.

Here is the code that it is running:

Code: [Select]
#include "PS2Mouse.h"
#define DATA_PIN 9
#define CLOCK_PIN 3

PS2Mouse mouse(DATA_PIN, CLOCK_PIN);

void setup() {
  Serial.begin(9600);
  mouse.initialize();
}

void loop() {
    MouseData data = mouse.readData();
    Serial.print(data.status, BIN);
    Serial.print("\tx=");
    Serial.print(data.position.x);
    Serial.print("\ty=");
    Serial.print(data.position.y);
    Serial.print("\twheel=");
    Serial.print(data.wheel);
    Serial.println();
    delay(20);
}


The serial port does not display any data, even when I have the correct port checked and the code uploads without any issue. However, very rarely it will work without any issue when powered on, and once unplugged, it refuses to output values again. I am at a loss to what is going on here, any help that someone could offer would be greatly appreciated, and I will supply additional photos or information on the device if requested.

Thank you!

Riva

A quick look at the PS2Mouse github link you posted and I see no reference to mouse.initialize(); in the library or the sample ino file posted with it.
What happens if you just use the sample code on github (adjusting the pins to either suit the sketch or your pinout), does it still fail to work okay?
Don't PM me for help as I will ignore it.

Laffinm

I tried out the sample code and it started to work fine! Thank you!

Go Up