If you have “Help” instead of “Ins”, replace it with Overgod-tier. Keep pressing it, it will come.

OC, feel free to share.

EDIT; Home is now G-od tier. I didn’t know it would go to the beginning of a line, I always used macros “lol”.

  • Heavybell@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    11 months ago

    I bought an existing foot pedal off aliexpress. It came with a little dangling wire, supposedly meant to be hooked up to a piece of industrial equipment. Opened it up, removed the existing wire, soldered a wire to a suitable arduino dev board and hot glued it inside. If you want I can dig up the exact parts I used and even the code. But I also suspect maybe you want to figure it out yourself?

    • MystikIncarnate@lemmy.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      10 months ago

      Some bits I can certainly figure out. The Arduino code is the part I’ll be very bad at; so if you can get that without too much trouble, I would appreciate it.

      I’m sure I’ll use a different pedal than what you did, since I don’t know if the supply availability will be the same, but honestly, it’s just a fancy switch designed to be used by a foot, so I’m sure it’s nothing difficult.

      If it’s too difficult to find the code, no worries, I’m sure there’s plenty of examples around the internet of similar types of code for different purposes (like a shortcut keyboard or something). I’m certain that we’re not the first and certainly not the last to want something similar in function.

      • Heavybell@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        10 months ago

        Here’s the code I wrote:

        #include "Keyboard.h"
        
        const char FUNCTION_F14 = 0xF1;
        int down = 0;
        
        void setup() {
          // make pin 2 an input and turn on the
          // pullup resistor so it goes high unless
          // connected to ground:
          pinMode(2, INPUT_PULLUP);
          // initialize control over the keyboard:
          Keyboard.begin();
        }
        
        void loop() {
          int nowDown = digitalRead(2) == LOW;
        
          if (down != nowDown) {
            down = nowDown;
        
            if (down) {
              Keyboard.press(FUNCTION_F14);
            } else {
              Keyboard.release(FUNCTION_F14);
            }
          }
        }
        

        Note that the #include was meant to use angle brackets, but Lemmy ate them. If this doesn’t work, change it back to angle brackets around the Keyboard.h instead of quotes.

        Also, the parts I used:

        I wired it up like in the photo, and just laid it on a bed of hot glue so the USB port sticks out the hole. I had intended to get a mini USB extension cable inside the pedal, but the one I ordered turned up defective, and this worked out just fine.

        • MystikIncarnate@lemmy.ca
          link
          fedilink
          English
          arrow-up
          2
          ·
          10 months ago

          Excellent. Thanks for digging this up.

          I’m just wondering what you used to bind F14 to do something on your PC? Some companion application?

          • Heavybell@lemmy.world
            link
            fedilink
            English
            arrow-up
            2
            ·
            10 months ago

            I just noticed lemmy didn’t like the #include statement because it uses angle brackets. I tried to update it but it doesn’t look right, so I’m going to change it to quotes which should work the same, I believe. I’m not a C expert, I usually code in C#.