The Random Thoughts of a Geek heading for Banbury
The Random Thoughts of a Geek heading for Banbury

Affordable Accessible Mouse – Part 2: Teensy Mouse/Stick

I have found a Europeen supplier of the Teensy Micro controler; sell it from the Netherlands, you can still get all the details on how to use it from


I am using the Arduino IDE (from and the Teensy Loader (from PJRC) this gives me the following pin out:

Arduino pinout teensy

My current code for the moment sits at:

#define NORT 0  // North
#define EAST 1  // East
#define SOUT 2  // South
#define WEST 3  // West

#define LEFT 6  // Left Click
#define DOUB 7  // Double Click
#define LOCK 8  // Click Lock
#define RIGH 9  // Right Click
#define SCRO 10 // Scroll Lock

#define LED 11   // On PCB LED
#define CLED 6  // Click Lock LED
#define SLED 7  // Scroll Lock LED

void setup()
  // initialize the four pins for the D Pad
    pinMode(NORT, INPUT_PULLUP);
    pinMode(EAST, INPUT_PULLUP);
    pinMode(SOUT, INPUT_PULLUP);
    pinMode(WEST, INPUT_PULLUP);
  // initialize the Five Pins for the Buttons
    pinMode(LEFT, INPUT_PULLUP);
    pinMode(DOUB, INPUT_PULLUP);
    pinMode(LOCK, INPUT_PULLUP);
    pinMode(RIGH, INPUT_PULLUP);
    pinMode(SCRO, INPUT_PULLUP);

  // initialize the Three Pins for the LEDs
    pinMode(LED, OUTPUT);   // This is the LED on the Teensy PCB,
    pinMode(CLED, OUTPUT);
    pinMode(SLED, OUTPUT);

void loop()
  int X;
  int Y;
  int speed;
  X = 0;
  Y = 0;
  speed = 1;  // number between 1 and something bigger, if speed = 0 well… FAIL
  if (digitalRead(NORT) == LOW)
      X = 1;
  if (digitalRead(EAST) == LOW)
      Y = 1;
  if (digitalRead(SOUT) == LOW)
      X = -1;
  if (digitalRead(WEST) == LOW)
      Y = -1;
  Mouse.move(X * speed, Y * speed);

I would appreciate any one who can poke my code for me to help me write better code 🙂

IMG 2450

This is my set up at the moment, I haven’t yet got a desk; so I work on my bed,

Leave a comment

Your email address will not be published.