Close
0%
0%

e accent aigu, é, - big red button

Sometimes you just need a button for a letter with an accent

Similar projects worth following
0 followers
Learning French can be a touch frustrating on a regular English keyboard - so why not make it like a video game? Using a raspberry pi pico, circuit python, and a big video game button, you can get é anytime you want!

Start with a raspberry pi pico.

Install CircuitPython.

Copy in the adafruit_hid folder into the lib directory on the pico.

Create the main.py file in the main directory of the pico.

Attach the video game button to pin 1 (i.e., GPIO0) of the pico and pin 3 (GND). I did not use the LED of the video game button for this project.

Press the video game button, and get the é.

py - 1.56 kB - 06/25/2023 at 17:29

Download

  • 1 × Raspberry Pi Pico
  • 1 × Adafruit Arcade Button

  • main.py

    sciencedude199006/25/2023 at 17:37 0 comments

    # Imports
    import usb_hid
    from adafruit_hid.keyboard import Keyboard
    from adafruit_hid.keycode import Keycode
    import digitalio
    import time
    import board
    
    # Make a keyboard
    kbd = Keyboard(usb_hid.devices)
    
    # The big red button
    btn_red = digitalio.DigitalInOut(board.GP0)
    btn_red.direction = digitalio.Direction.INPUT
    btn_red.pull = digitalio.Pull.UP
    
    # State variable
    keydown = 1
    
    # Loop forever
    while True:
        
        if btn_red.value == 1:
            print("1")
            # Set the state variable back to 1
            keydown = 1        
        else:        
            print("0")
            
            # Only if the state variable is 1, press the keys (stops rapidly keying)
            if keydown == 1:
                
                # Press and hold the LEFT ALT
                kbd.press(Keycode.LEFT_ALT)
                
                # Press and release keypad 0
                kbd.press(Keycode.KEYPAD_ZERO)
                kbd.release(Keycode.KEYPAD_ZERO)
                
                # Press and release keypad 2
                kbd.press(Keycode.KEYPAD_TWO)
                kbd.release(Keycode.KEYPAD_TWO)
                
                # Press and release keypad 3
                kbd.press(Keycode.KEYPAD_THREE)
                kbd.release(Keycode.KEYPAD_THREE)
                
                # Press and release keypad 3
                kbd.press(Keycode.KEYPAD_THREE)
                kbd.release(Keycode.KEYPAD_THREE)
                
                # Release all keys
                kbd.release_all()
        
            # Set the state variable
            keydown = 0
            
        # Sleep for a bit
        time.sleep(0.03)
        
    

  • Special Key Codes

    sciencedude199006/25/2023 at 17:34 0 comments

    In the code, I wanted e accent aigu, but you could use any of the codes you want, or add more buttons!

    Alt+0233 (é)
    Alt+0224 (à)
    Alt+0232 (è)
    Alt+0249 (ù)
    Alt+0226 (â)
    Alt+0234 (ê)
    Alt+0238 (î)
    Alt+0244 (ô)
    Alt+0251 (û)
    Alt+0235 (ë)
    Alt+0239 (ï)
    Alt+0252 (ü)
    Alt+0231 (ç)

    The magic is that you have to "press" and "release" the KEYPAD numbers after the ALT key has been pressed, then release all the keys, i.e.,

    # Press and hold the LEFT ALT
    kbd.press(Keycode.LEFT_ALT)
                
    # Press and release keypad 0
    kbd.press(Keycode.KEYPAD_ZERO)
    kbd.release(Keycode.KEYPAD_ZERO)
                
    # Press and release keypad 2
    kbd.press(Keycode.KEYPAD_TWO)
    kbd.release(Keycode.KEYPAD_TWO)
                
    # Press and release keypad 3
    kbd.press(Keycode.KEYPAD_THREE)
    kbd.release(Keycode.KEYPAD_THREE)
                
    # Press and release keypad 3
    kbd.press(Keycode.KEYPAD_THREE)
    kbd.release(Keycode.KEYPAD_THREE)
                
    # Release all keys
    kbd.release_all()

View all 2 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates