Category Archives: Tech

Macro Buttons

A box with macro buttons for your PC using Arduino Leonardo

#include <Keypad.h> // matrix read
#include <Keyboard.h> // keyboard out

#define ENABLE_PULLUPS // fuck the resistors
#define NUMBUTTONS 25 // matrix
#define NUMROWS 5 // matrix rows
#define NUMCOLS 5 // matrix cols

int analog1 = A3;
int analog2 = A7;


int inPinctrl = 3;  // function ctrl, pull to vcc
int inPinalt = 4;  // function alt, pull to vcc 
int valctrl = 0;    // variable to store shifter
int valalt = 0;    // variable to store shifter
int joyx = 0;
int joyy = 0;

//define the symbols per key
char buttons[NUMROWS][NUMCOLS] = {
  {'q','w','e','r','t'},
  {'y','u','i','o','p'},
  {'a','s','d','f','g'},
  {'h','j','k','l','z'},
  {'x','c','v','b','n'},
};
// q-1 (star)      e-zoomin    r-prev t-up
// y-2 u-clearstar             o-open p-down
// a-3 (rate)      d-zoomreset f-full g-left
// h-4 j-clearrate             l-esc  z-right
// x-5 c-slideshow v=zoomout   b-next

//    14 16 10 9  8 
// 21 q  y  a  h  x  
// 20 w  u  s  j  c
// 19 e  i  d  k  v 
// 18 t  p  g  z  n
// 15 r  o  f  l  b 

byte rowPins[NUMROWS] = {16,20,19,18,15}; //connect to the row pinouts of the keypad
byte colPins[NUMCOLS] = {14,7,10,9,8}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad buttbx = Keypad( makeKeymap(buttons), rowPins, colPins, NUMROWS, NUMCOLS); 


void setup() {

  Serial.begin(115200); // debug out baud
  pinMode(inPinctrl, INPUT);    // sets the digital pin 3 as input
  pinMode(inPinalt, INPUT);    // sets the digital pin 4 as input
  digitalWrite(inPinctrl, HIGH);       // turn on pullup resistors
  digitalWrite(inPinalt, HIGH);       // turn on pullup resistors
  Keyboard.begin();        // keyb starter
}



void loop() { // loop the program

  CheckAllButtons(); // check tha buttons

}


void CheckAllButtons(void) {
  joyx = analogRead(analog1);
  joyy = analogRead(analog2);
  Serial.println(joyx);
  Serial.println(joyy);
  if (joyx > 900) { 
      Keyboard.press(KEY_UP_ARROW);
      delay(150);
      Keyboard.releaseAll();
  }
  if (joyx < 200) { 
      Keyboard.press(KEY_DOWN_ARROW);
      delay(150);
      Keyboard.releaseAll();      
  }
  if (joyy > 900) { 
      Keyboard.press(KEY_LEFT_ARROW);
      delay(150);
      Keyboard.releaseAll();
  }
  if (joyy < 200) { 
      Keyboard.press(KEY_RIGHT_ARROW);
      delay(150);
      Keyboard.releaseAll();
  }

  
  char key = buttbx.getKey();

  if (key != NO_KEY)  {
      valctrl = digitalRead(inPinctrl);   // read the function pin
      valalt = digitalRead(inPinalt);   // read the function pin
      Serial.write(valctrl);  // debug
      Serial.println();  // enter
      Serial.write(valalt);  // debug
      Serial.println();  // enter
      Serial.write(key);  // debug
      Serial.println();  // enter
      // button 1 
          if (key == 'q') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('1');
           delay(150);
           Keyboard.releaseAll();
          }
      // button 2
          if (key == 'y') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('2');
           delay(150);
           Keyboard.releaseAll();
          }
      // button 3
          if (key == 'a') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('3');
           delay(150);
           Keyboard.releaseAll();
          }
      // button 4
          if (key == 'h') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('4');
           delay(150);
           Keyboard.releaseAll();
          }
      // button 5
          if (key == 'x') {
            if (valctrl == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_CTRL); 
            }
            if (valalt == 0) { // function shifter active?
               Keyboard.press(KEY_LEFT_ALT); 
            }
           Keyboard.press('5');
           delay(150);
           Keyboard.releaseAll();
          }
      // button i - clear rate
          if (key == 'i') {
           Keyboard.press(KEY_LEFT_CTRL); 
           Keyboard.press('0');
           delay(150);
           Keyboard.releaseAll();
          }
      // button k - clear label
          if (key == 'k') {
           Keyboard.press(KEY_LEFT_ALT); 
           Keyboard.press('0');
           delay(150);
           Keyboard.releaseAll();
          }
      // button v - slideshow
          if (key == 'v') {
           Keyboard.press(KEY_ESC); 
           Keyboard.press(KEY_LEFT_CTRL); 
           Keyboard.press('s');
           delay(150);
           Keyboard.releaseAll();
          }
      // button t - zoomin
          if (key == 't') {
           Keyboard.press('+'); 
           delay(150);
           Keyboard.releaseAll();
          }
      // button g - zoomreset
          if (key == 'g') {
           Keyboard.press('*');
           delay(150);
           Keyboard.releaseAll();
          }
      // button n - zoomout
          if (key == 'n') {
           Keyboard.press('-'); 
           delay(150);
           Keyboard.releaseAll();
          }
//r  o  f  l  b
      // button r - prev
          if (key == 'r') {
           Keyboard.press(KEY_LEFT_CTRL); 
           Keyboard.press(KEY_LEFT_ARROW); 
           delay(150);
           Keyboard.releaseAll();
          }
           
      // button o - open
          if (key == 'o') {
           Keyboard.press(KEY_RETURN); 
           delay(150);
           Keyboard.releaseAll();
          }
           
      // button f - full
          if (key == 'f') {
           Keyboard.press('f'); 
           delay(150);
           Keyboard.releaseAll();
          }
           
      // button l - esc
          if (key == 'l') {
           Keyboard.press(KEY_ESC); 
           delay(150);
           Keyboard.releaseAll();
          }
           
      // button b - next
          if (key == 'b') {
           Keyboard.press(KEY_LEFT_CTRL); 
           Keyboard.press(KEY_RIGHT_ARROW); 
           delay(150);
           Keyboard.releaseAll();
          }
           





          
  }
}

Ordered a powerbank, got a drugs delivery? (not really)

I ordered a powerbank a while ago, which had to be shipped from china.

I got this, and tought “I’ve been scammed”

A adaptor without label/manual and NOT what i’ve ordered

So i send a mail to the place i’ve ordered from, this was their answer.

You need to unscrew the adapter, in which you will find your ordered product.
Your product has been shipped in this way since they can still be difficult at customs.
And then the shipping will take longer again.

Opening the adaptor:

My order

Staircase pictures

Maybe you also have a white area to fill, here is a suggestion.

For years we collected picture frames, weird and ugly.
We wanted to have a collection of images in our staircase, to fill the white area.
The images are all something we like, have interest in or are personal.

It needed to be on 3 walls, so here was my first design.

Around the corner picture frame i made

Working on the NS train displays

Working to get the Dutch Railways Signs working.

I was working on the backend, but frequently was asked to help working on the boards.

I can’t post any other pictures, because they are revealing to much information

I’ve worked on the boards, backend and a peer2peer VPN solution

Restricted Content
To view this protected content, enter the password below: