DIY Build Button

 

I wanted a cool way for building projects on IntelliJ, sure pressing that small green button on the top of my IDE was functional but i wanted a pleasing and noisy button to get the job done. What about a shiny red emercency button?

First we have to buy a big red button and an Arduino (or derivate) capable of appear as a native Keyboard, I chose a Pro Micro board from SparkFun

spare_parts

We need to make a little modification to the button removing two little screws like in photo; otherwhise we’ll have to rotate it in order to disarm it after pressed.

button_mod_1

 

Now we can hook up some wires to Pro Mini pins, i used pin 9 enabling its internal pull-up, here the code:

#include 
int buttonPin = 9;

void setup()
{
  pinMode(buttonPin, INPUT);  // Set pin as input
  digitalWrite(buttonPin, HIGH);  // Enable internal pull-up
  Keyboard.begin();//Init control over keyb
  Serial.begin(9600);
  delay(1000);
}

void loop()
{
  if (digitalRead(buttonPin) == 1) //The emerg.button is normally closed!
    {
        Keyboard.press(KEY_LEFT_SHIFT);//Press Shift
        Keyboard.press(KEY_F10);//Press F10
        delay(100);//Wait for propag
        Keyboard.releaseAll();//Relase them all
        delay(1000);
    }
}

That’s done!


 

 

 

 

 

 

 

 

 

 

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *