Hello,
Here is my little contribution on how to connect a Spintrak to the Teensy enabling a HID mouse.
I'm using the Mouse and Encoder library. Big thanks to the author(s).
This is for 1 spinner on the x axis, but you can add a second one on the y axis.
Here is the source code I'm using:
Also, if you want a Mouse Only profile you can take a look at this thread:
https://forum.pjrc.com/threads/29405-Teensyduino-USB-Mouse-Only-profile
Pitou!
Here is my little contribution on how to connect a Spintrak to the Teensy enabling a HID mouse.
I'm using the Mouse and Encoder library. Big thanks to the author(s).
This is for 1 spinner on the x axis, but you can add a second one on the y axis.
Here is the source code I'm using:
Code:
#define ENCODER_OPTIMIZE_INTERRUPTS
#include <Encoder.h>
Encoder spinner_x(2, 3);
int x, prev_x = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
int diff_x;
x = spinner_x.read();
diff_x = x - prev_x;
Serial.print("Spinner 1 = ");
Serial.print(diff_x);
Serial.println();
Mouse.move(diff_x, 0);
prev_x = x;
}
Also, if you want a Mouse Only profile you can take a look at this thread:
https://forum.pjrc.com/threads/29405-Teensyduino-USB-Mouse-Only-profile
Pitou!