• 0 Posts
  • 59 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle












  • The problem with blazor as I understand it, is that no, it does not compile your C# into WASM. Instead, it compiles into a standard .net module – with as much excising of unused code as possible – and distributes it with a CLR that is compiled to WASM. So effectively you’re running the .net VM inside the WASM VM. If you do client-side blazor, which is not even MS’s push anymore because they stand to make more money if you write server-side blazor and deploy it to Azure.

    Do look it up yourself tho. I could have a totally wrong understanding. I haven’t looked into it in some time because I’ve not been in a position to start a new frontend project from scratch. I would love to do my frontend stuff in C# though, don’t get me wrong.





  • 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.


  • 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?