The idea for this project was to bring computing freedom back to those with limited physical abilities. This is tailored for my mother who has Multiple Scleroris. This project alters Arduino's Button Push Mouse Control program to use only one button.

When the button is pressed and held, the lights in an LED array will turn on one by one until the user releases the button on their selection. The loop is then paused awaiting input from the user. If the button is not pressed within approximately 5 seconds, the program resets. If the button is pressed and held, the mouse will either move in the direction selected or perform mouse clicks (left, right, or double click).

Here are the things you'll need to get started:
Arduino Leonardo
1 - 10k ohm resistor
7 - ohm resistors
7 - white LEDs
jumper wires varying lengths (15 should be enough)
momentary push button
solderless bread board

Step 1: Getting Started

Download Code attached, and open in a fresh Arduino Sketch. Set board to Leonardo by going to the menu bar and "Tools", "Board>" Leonardo.

First set up resistors, LEDs, jumper wires, and button on bread board before plugging into Arduino board. Diagram is attached to help show placement. 

Place LEDs in breadboard, spread evenly apart. (refer to diagram)

Plug one end of a resistor in the same rail as the cathode and the other end to the ground rail.

Set button in breadboard.

Connect the 10k ohm resistor to ground and the other end of the resistor to one pin of the button
Opposite to the ground a jumper wire should be placed and connected to Digital input 2 on the Arduino

On the same side as the ground pin of the button, the other pin should be connected to the positive rail

Now, use jumper cables to attach the anodes of the LEDs to the Arduino.
The LEDs will connect to the following inputs:
    1st - 4
    2nd - 5
    3rd - 6
    4th - 7
    5th - 8
    6th - 9
    7th - 10

Connect jumpers from Arduino's Ground input to the breadboards ground rail and from 5V slot to the positive power rail

Step 2: Double Check and Getting Started

Double check the connections. Unless everything is connected properly, the program won't work, and the board can potentially be burnt out.

Once you've ensured everything is in order, connect the board to you computer via MicroUSB.

Upload the code. If everything goes right, the program will work as in the video

Step 3: Tips

I had a hard to explaining everything. If you have any question just leave them in the comments, and I'll try to help resolve any confusion.

A few parts in the code can be manipulated to slow down or speed the loops or delays.

Interval will allow the loop to reset if the user chooses the wrong selection in the loop. Increase interval's value to increase the time the loop is paused before breaking

int upState = 0;
  int downState = 0;
  int leftState = 0;
  int rightState = 0;
  int clickState = 0;
  int dbl = 0;
  unsigned long interval = 80;
  int j = 0; // counter for timing loop
  if(j > 0) {
   j = 0;
  if(i <= 4) {
    while(digitalRead(button) == LOW) {

      /* this loop needed to be built this way because using the
      (currentMillis - previousMillis) > interval);
       previousMillis = currentMillis;
        seemed to break the loop and would set properly

if(j == interval) {
       counter = 0;
      } else {

The delay time controls the speed of the movement of the mouse. Increasing the delay will make the mouse move slower, and
decreasing the value will have the inverse effect.

while(digitalRead(button) == HIGH) {
      switch (i) {
      case 1:
        upState = digitalRead(2);
        counter = 0;
      case 2:
        downState = digitalRead(2);
        counter = 0;
      case 3:
        leftState = digitalRead(2);
        counter = 0;
      case 4:
        rightState = digitalRead(2);
        counter = 0;
        Serial.println("Do Nothing");
        counter = 0;
      } // end switch

About This Instructable



Bio: My introversion makes me incredibly boring. I loathe reality television. I love things that are designed for practicality.
More by ileesamsaoh:One Button Mouse Controller 
Add instructable to: