Exemplo n.º 1
0
    button = DigitalInOut(p)
    button.direction = Direction.INPUT
    button.pull = Pull.UP
    buttons.append(button)

# Servo on D5
# create a PWMOut object on Pin D5
pwm = pwmio.PWMOut(board.D5, duty_cycle=2 ** 15, frequency=50)
servo = servo.Servo(pwm)

# NeoPixel strip (of 16 LEDs) connected on D6
NUMPIXELS = 16
neopixels = neopixel.NeoPixel(board.D6, NUMPIXELS, brightness=0.2, auto_write=False)

# Used if we do HID output, see below
kbd = Keyboard()

######################### HELPERS ##############################

# Helper to convert analog input to voltage
def getVoltage(pin):
    return (pin.value * 3.3) / 65536

# Helper to give us a nice color swirl
def wheel(pos):
    # Input a value 0 to 255 to get a color value.
    # The colours are a transition r - g - b - back to r.
    if (pos < 0):
        return [0, 0, 0]
    if (pos > 255):
        return [0, 0, 0]
Exemplo n.º 2
0
import usb_hid
from digitalio import DigitalInOut, Direction, Pull

from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode

switch = DigitalInOut(board.GP20)
switch.direction = Direction.INPUT
switch.pull = Pull.UP

switch2 = DigitalInOut(board.GP21)
switch2.direction = Direction.INPUT
switch2.pull = Pull.UP

keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)

while True:
    if not switch.value:
        print('y')
        keyboard.press(Keycode.LEFT_ALT, Keycode.F1)
        keyboard.release_all()

    if not switch2.value:
        print('y')
        keyboard.press(Keycode.LEFT_ALT, Keycode.F2)
        keyboard.release_all()

    print('---')
    time.sleep(0.2)
Exemplo n.º 3
0
def keyboard_config(key_to_be_pressed):
    kbd = Keyboard(usb_hid.devices)
    layout = KeyboardLayoutUS(kbd)
    kbd.send(key_to_be_pressed)
Exemplo n.º 4
0
    def __init__(self, debug=False):
        self.debug = debug
        #self.mouse = Mouse(usb_hid.devices)
        self.keyboard = Keyboard(usb_hid.devices)
        self.keyboard_layout = KeyboardLayoutUS(
            self.keyboard)  # Change for non-US
        self.default_delay = 0
        self.string_delay = 0
        self.last_cmd = ""
        self.last_arg = ""

        # Keycode only has US mappings, not sure if AdaFruit has others
        #
        # TODO - consider a data structure which consumes less RAM for
        # constrained platforms.
        #
        # Keep a separate structure for multi-key combos to lower memory
        # usage.
        #
        self.tuple_keymap = {
            "CTRL-ALT": (Keycode.CONTROL, Keycode.ALT),
            "CTRL-SHIFT": (Keycode.CONTROL, Keycode.SHIFT),
            "ALT-SHIFT": (Keycode.ALT, Keycode.SHIFT)
        }

        self.keymap = {
            "ALT": Keycode.ALT,
            "APP": Keycode.APPLICATION,
            "BREAK": Keycode.PAUSE,
            "CAPSLOCK": Keycode.CAPS_LOCK,
            "CONTROL": Keycode.CONTROL,
            "CTRL": Keycode.CONTROL,
            "DELETE": Keycode.DELETE,
            "DOWNARROW": Keycode.DOWN_ARROW,
            "DOWN": Keycode.DOWN_ARROW,
            "END": Keycode.END,
            "ENTER": Keycode.ENTER,
            "ESC": Keycode.ESCAPE,
            "ESCAPE": Keycode.ESCAPE,
            "GUI": Keycode.GUI,
            "HOME": Keycode.HOME,
            "INSERT": Keycode.INSERT,
            "LEFTARROW": Keycode.LEFT_ARROW,
            "LEFT": Keycode.LEFT_ARROW,
            "MENU": Keycode.APPLICATION,
            "NUMLOCK": Keycode.KEYPAD_NUMLOCK,
            "PAGEUP": Keycode.PAGE_UP,
            "PAGEDOWN": Keycode.PAGE_DOWN,
            "PAUSE": Keycode.PAUSE,
            "PRINTSCREEN": Keycode.PRINT_SCREEN,
            "RIGHTARROW": Keycode.RIGHT_ARROW,
            "RIGHT": Keycode.RIGHT_ARROW,
            "SCROLLLOCK": Keycode.SCROLL_LOCK,
            "SHIFT": Keycode.SHIFT,
            "SPACE": Keycode.SPACE,
            "TAB": Keycode.TAB,
            "UPARROW": Keycode.UP_ARROW,
            "UP": Keycode.UP_ARROW,
            "WINDOWS": Keycode.WINDOWS,
            "a": Keycode.A,
            "A": Keycode.A,
            "b": Keycode.B,
            "B": Keycode.B,
            "c": Keycode.C,
            "C": Keycode.C,
            "d": Keycode.D,
            "D": Keycode.D,
            "e": Keycode.E,
            "E": Keycode.E,
            "f": Keycode.F,
            "F": Keycode.F,
            "g": Keycode.G,
            "G": Keycode.G,
            "h": Keycode.H,
            "H": Keycode.H,
            "i": Keycode.I,
            "I": Keycode.I,
            "j": Keycode.J,
            "J": Keycode.J,
            "k": Keycode.K,
            "K": Keycode.K,
            "l": Keycode.L,
            "L": Keycode.L,
            "m": Keycode.M,
            "M": Keycode.M,
            "n": Keycode.N,
            "N": Keycode.N,
            "o": Keycode.O,
            "O": Keycode.O,
            "p": Keycode.P,
            "P": Keycode.P,
            "q": Keycode.Q,
            "Q": Keycode.Q,
            "r": Keycode.R,
            "R": Keycode.R,
            "s": Keycode.S,
            "S": Keycode.S,
            "t": Keycode.T,
            "T": Keycode.T,
            "u": Keycode.U,
            "U": Keycode.U,
            "v": Keycode.V,
            "V": Keycode.V,
            "w": Keycode.W,
            "W": Keycode.W,
            "x": Keycode.X,
            "X": Keycode.X,
            "y": Keycode.Y,
            "Y": Keycode.Y,
            "z": Keycode.Z,
            "Z": Keycode.Z,
            #
            # The DuckyScript encoder didn't appear to have the following codes and
            # probably used the STRING command to deal with some of them. Adding them shouldn't
            # hurt but does consume RAM. Some are Mac specific.
            #
            "F1": Keycode.F1,
            "F2": Keycode.F2,
            "F3": Keycode.F3,
            "F4": Keycode.F4,
            "F5": Keycode.F5,
            "F6": Keycode.F6,
            "F7": Keycode.F7,
            "F8": Keycode.F8,
            "F9": Keycode.F9,
            "F10": Keycode.F10,
            "F11": Keycode.F11,
            "F12": Keycode.F12,
            "F13": Keycode.F13,
            "F14": Keycode.F14,
            "F15": Keycode.F15,
            "F16": Keycode.F16,
            "F17": Keycode.F17,
            "F18": Keycode.F18,
            "F19": Keycode.F19,
            "BACKSLASH": Keycode.BACKSLASH,
            "COMMA": Keycode.COMMA,
            "COMMAND": Keycode.COMMAND,
            "FORWARD_SLASH": Keycode.FORWARD_SLASH,
            "GRAVE_ACCENT": Keycode.GRAVE_ACCENT,
            "LEFT_BRACKET": Keycode.LEFT_BRACKET,
            "OPTION": Keycode.ALT,
            "PERIOD": Keycode.PERIOD,
            "POUND": Keycode.POUND,
            "QUOTE": Keycode.QUOTE
        }
Exemplo n.º 5
0
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import time
import random
from adafruit_circuitplayground.express import cpx

from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
 
keyboard = Keyboard()
layout = KeyboardLayoutUS(keyboard)

ROLL_THRESHOLD  = 30        # Total acceleration 
DICE_COLOR      = (0xEA, 0x62, 0x92)  # Dice digits color
DICE_MAXBRIGHTNESS = 6

# dictionary storing the NeoPixels to set for each face
dice_pixels = {
 1 : (2,),
 2 : (4, 9),
 3 : (0, 4, 7),
 4 : (1, 3, 6, 8),
 5 : (0, 2, 4, 5, 9),
 6 : (0, 2, 4, 5, 7, 9)
}
Exemplo n.º 6
0
Wood Elf
By J.H.Grace

A CircuitPython-based keyboard matrix

"""

import board
from digitalio import DigitalInOut, Direction, Pull
import neopixel
from random import randint
from adafruit_hid.keycode import Keycode
from adafruit_hid.keyboard import Keyboard
from time import monotonic, sleep

kbd = Keyboard(
)  # This is the virtual keyboard device.  Currently, CircuitPython only supports a single virtual keyboard.  The hope is one day this may change, and I'll be able to have full n-key rollover.  For now though, only 6-key rollover is supported.
QueuePress = [
]  # Each cycle, all pressed keys with simple keypresses are added to this queue and processed afterwards.
QueueRelease = [
]  # Ditto as above, but for keys that were pressed and are now released.
PressedKeys = [
]  # This stores all keys that are currently pressed to the virtual keyboard.
KeyIndex = 0  # Stores the index of the current key that is being cycled through.
Timer = 0  # For debug purposes.

Columns = [
    DigitalInOut(x) for x in (board.A2, board.A3, board.A4, board.A5, board.D2,
                              board.D3, board.D4, board.D7)
]
Rows = [
    DigitalInOut(x)
Exemplo n.º 7
0
"""programme 6-8-2 : saisie dans un tableur"""
# importation des modules natifs utiles
from time import *
from board import *
from digitalio import *
# importation de modules supplémentaires
from adafruit_lsm6ds import *
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS

# Instanciation du clavier
clavier = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(clavier)

# Instanciation du bus de communication I2C sur le module Feather
bus_i2c = I2C()
# Instanciation de l'accéléromètre LSM6DS33
accelerometre = LSM6DS33(bus_i2c)

# Instanciation de la LED interne et du bouton interne
led = DigitalInOut(D13)
led.direction = Direction.OUTPUT
led.value = False
bouton = DigitalInOut(SWITCH)
bouton.pull = Pull.UP

# Attente d'appui sur le bouton permettant à l'utilisateur de se placer
# sur la feuille de son tableur
while bouton.value:
# adafruit_pypixelbuf.mpy
# neopixel.mpy

import board
import time
import usb_hid
import neopixel

from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS

pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)

time.sleep(1)  # sleep for a bit to avoid a race condition on some systems
kbd = Keyboard(usb_hid.devices)  # the keyboard object!
layout = KeyboardLayoutUS(kbd)  # you're americans :)

num_lock = False  # NUM LOCK
caps_lock = False  # CAPS LOCK
scroll_lock = False  # SCROLL LOCK


def update_lock():
    global num_lock, caps_lock, scroll_lock
    report = int.from_bytes(usb_hid.devices[0].last_received_report, "big")
    num_lock = (report & 0x01) == 0x01  # NUM LOCK
    caps_lock = (report & 0x02) == 0x02  # CAPS LOCK
    scroll_lock = (report & 0x04) == 0x04  # SCROLL LOCK

Exemplo n.º 9
0
device_info = DeviceInfoService(software_revision=adafruit_ble.__version__,
                                manufacturer="Adafruit Industries")
advertisement = ProvideServicesAdvertisement(hid)
advertisement.appearance = 961
scan_response = Advertisement()
scan_response.complete_name = "CircuitPython HID"

ble = adafruit_ble.BLERadio()
if not ble.connected:
    print("advertising")
    ble.start_advertising(advertisement, scan_response)
else:
    print("already connected")
    print(ble.connections)

k = Keyboard(hid.devices)
kl = KeyboardLayoutUS(k)
while True:
    while not ble.connected:
        pass
    print("Start typing:")

    while ble.connected:
        if not button_1.value:  # pull up logic means button low when pressed
            #print("back")  # for debug in REPL
            k.send(Keycode.BACKSPACE)
            time.sleep(0.1)

        if not button_2.value:
            kl.write("Bluefruit")  # use keyboard_layout for words
            time.sleep(0.4)
Exemplo n.º 10
0
    """ Callback for when the buttons are released """
    k.release_all()
    dot[0] = (0, 0, 0)
    led.value = 0


""" Set up the board's input and output """

# Set up the "Dotstar" RGB LED on the Trinket M0 board
# They're designed to work in a sequence with a string of other LEDs,
# but since you only have one you'll just set the value for dot[0]
dot = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=lB)
dot[0] = (0, 0, 0)

# Set up the Keyboard object
k = Keyboard()
kL = KeyboardLayoutUS(k)

# The "Right" physical button, or "bR", is wired up so that pressing down will
# make an electrical connection from pin D2 on the board to the ground power connection.
# For this to work, set the pin D2 to be an Input, with an internal resistor pulling
# the pin "up" away from the ground.
bR = DigitalInOut(board.D2)
bR.direction = Direction.INPUT
bR.pull = Pull.UP
#   Note! If you have a "v1" board from RoboThon, you will need to pull the pin DOWN instead.
#   There was a small electrical change that was made to the board after this first version.

# Same for the "Left" physical button, "bL", but this time on pin D0.
bL = DigitalInOut(board.D0)
bL.direction = Direction.INPUT
Exemplo n.º 11
0
import time
import digitalio
import board
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode

boton1_pin = board.GP16
boton2_pin = board.GP17
boton3_pin = board.GP18
boton4_pin = board.GP19
boton5_pin = board.GP20

teclado = Keyboard(usb_hid.devices)

boton1 = digitalio.DigitalInOut(boton1_pin)
boton1.direction = digitalio.Direction.INPUT
boton1.pull = digitalio.Pull.DOWN

boton2 = digitalio.DigitalInOut(boton2_pin)
boton2.direction = digitalio.Direction.INPUT
boton2.pull = digitalio.Pull.DOWN

boton3 = digitalio.DigitalInOut(boton3_pin)
boton3.direction = digitalio.Direction.INPUT
boton3.pull = digitalio.Pull.DOWN

boton4 = digitalio.DigitalInOut(boton4_pin)
boton4.direction = digitalio.Direction.INPUT
boton4.pull = digitalio.Pull.DOWN
Exemplo n.º 12
0
class DuckyPy:
    from adafruit_hid.keyboard import Keyboard
    from adafruit_hid.keycode import Keycode
    import time

    kbd = Keyboard()
    
    def getkeycodede(self, arg):
            if arg == "A":
                return self.Keycode.SHIFT, self.Keycode.A;
            if arg == "B":
                return self.Keycode.SHIFT, self.Keycode.B;
            if arg == "C":
                return self.Keycode.SHIFT, self.Keycode.C;
            if arg == "D":
                return self.Keycode.SHIFT, self.Keycode.D;
            if arg == "E":
                return self.Keycode.SHIFT, self.Keycode.E;
            if arg == "F":
                return self.Keycode.SHIFT, self.Keycode.F;        
            if arg == "G":
                return self.Keycode.SHIFT, self.Keycode.G;
            if arg == "H":
                return self.Keycode.SHIFT, self.Keycode.H;
            if arg == "I":
                return self.Keycode.SHIFT, self.Keycode.I;            
            if arg == "J":
                return self.Keycode.SHIFT, self.Keycode.J;            
            if arg == "K":
                return self.Keycode.SHIFT, self.Keycode.K;            
            if arg == "L":
                return self.Keycode.SHIFT, self.Keycode.L;
            if arg == "M":
                return self.Keycode.SHIFT, self.Keycode.M;
            if arg == "N":
                return self.Keycode.SHIFT, self.Keycode.N;
            if arg == "O":
                return self.Keycode.SHIFT, self.Keycode.O;
            if arg == "P":
                return self.Keycode.SHIFT, self.Keycode.P;
            if arg == "Q":
                return self.Keycode.SHIFT, self.Keycode.Q;
            if arg == "R":
                return self.Keycode.SHIFT, self.Keycode.R;
            if arg == "S":
                return self.Keycode.SHIFT, self.Keycode.S;
            if arg == "T":
                return self.Keycode.SHIFT, self.Keycode.T;
            if arg == "U":
                return self.Keycode.SHIFT, self.Keycode.U;
            if arg == "V":
                return self.Keycode.SHIFT, self.Keycode.V;
            if arg == "W":
                return self.Keycode.SHIFT, self.Keycode.W;
            if arg == "X":
                return self.Keycode.SHIFT, self.Keycode.X;
            if arg == "Y":
                return self.Keycode.SHIFT, self.Keycode.Z;
            if arg == "Z":
                return self.Keycode.SHIFT, self.Keycode.Y;
            if arg == "a":
                return self.Keycode.A;
            if arg == "b":
                return self.Keycode.B;
            if arg == "c":
                return self.Keycode.C;
            if arg == "d":
                return self.Keycode.D;
            if arg == "e":
                return self.Keycode.E;
            if arg == "f":
                return self.Keycode.F;        
            if arg == "g":
                return self.Keycode.G;
            if arg == "h":
                return self.Keycode.H;
            if arg == "i":
                return self.Keycode.I;            
            if arg == "j":
                return self.Keycode.J;            
            if arg == "k":
                return self.Keycode.K;            
            if arg == "l":
                return self.Keycode.L;
            if arg == "m":
                return self.Keycode.M;
            if arg == "n":
                return self.Keycode.N;
            if arg == "o":
                return self.Keycode.O;
            if arg == "p":
                return self.Keycode.P;
            if arg == "q":
                return self.Keycode.Q;
            if arg == "r":
                return self.Keycode.R;
            if arg == "s":
                return self.Keycode.S;
            if arg == "t":
                return self.Keycode.T;
            if arg == "u":
                return self.Keycode.U;
            if arg == "v":
                return self.Keycode.V;
            if arg == "w":
                return self.Keycode.W;
            if arg == "x":
                return self.Keycode.X;
            if arg == "y":
                return self.Keycode.Z;
            if arg == "z":
                return self.Keycode.Y;
            if arg == " ":
                return self.Keycode.SPACE;
            if arg == ".":
                return self.Keycode.PERIOD;
            if arg == ":":
                return self.Keycode.SHIFT, self.Keycode.PERIOD;
            if arg == ";":
                return self.Keycode.SHIFT, self.Keycode.COMMA;
            if arg == ",":
                return self.Keycode.COMMA;
            if arg == "/":
                return self.Keycode.SHIFT, self.Keycode.SEVEN;
            if arg == "\\":
                return self.Keycode.RIGHT_ALT, self.Keycode.MINUS; 
            if arg == "?":
                return self.Keycode.SHIFT, self.Keycode.MINUS; 
            if arg == "-":
                return self.Keycode.FORWARD_SLASH;
            if arg == "_":
                return self.Keycode.SHIFT, self.Keycode.FORWARD_SLASH;
            if arg == "(":
                return self.Keycode.SHIFT, self.Keycode.EIGHT;
            if arg == ";":
                return self.Keycode.SHIFT, self.Keycode.NINE;
            if arg == "=":
                return self.Keycode.SHIFT, self.Keycode.ZERO;  
            if arg == "[":
                return self.Keycode.RIGHT_ALT, self.Keycode.EIGHT;
            if arg == "]":
                return self.Keycode.RIGHT_ALT, self.Keycode.NINE;
            if arg == "@":
                return self.Keycode.SHIFT, self.Keycode.TWO;
            if arg == "%":
                return self.Keycode.SHIFT, self.Keycode.FIVE;
            if arg == "1":
                return self.Keycode.ONE;
            if arg == "2":
                return self.Keycode.TWO;
            if arg == "3":
                return self.Keycode.THREE;
            if arg == "4":
                return self.Keycode.FOUR;
            if arg == "5":
                return self.Keycode.FIVE;
            if arg == "6":
                return self.Keycode.SIX;
            if arg == "7":
                return self.Keycode.SEVEN;
            if arg == "8":
                return self.Keycode.EIGHT;
            if arg == "9":
                return self.Keycode.NINE;
            if arg == "0":
                return self.Keycode.ZERO;
    
    def writeOneOrMultiple(self, arg):
        if isinstance(arg, int):
            self.kbd.send(arg)
        elif len(arg) == 2:
            self.kbd.send(arg[0], arg[1])
        elif len(arg) == 3:
            self.kbd.send(arg[0], arg[1], arg[2])
    
    def string(self, arg):
        le = list(arg)
        for x in range(0, len(le)):
            ler = self.getkeycodede(le[x])
            self.writeOneOrMultiple(ler)

    def desktop(self):
        self.kbd.send(self.Keycode.GUI, self.Keycode.D)

    def closeApp(self):
        self.kbd.send(self.Keycode.ALT, self.Keycode.F4)

    def windows(self):
        self.kbd.send(self.Keycode.GUI)

    def winR(self):
        self.kbd.send(self.Keycode.GUI, self.Keycode.R)

    def escape(self):
        self.kbd.send(self.Keycode.ESCAPE)

    def enter(self):
        self.kbd.send(self.Keycode.ENTER)

    def ctrl(self):
        self.kbd.send(self.Keycode.CONTROL)

    def ctrlI(self, arg):
        self.kbd.send(self.Keycode.CONTROL, arg)
        
    def cmd(self):
        self.winR()
        self.time.sleep(0.3)
        self.string("cmd.exe")
        self.enter()
    
    def menu(self):
        self.kbd.send(self.Keycode.SHIFT, self.Keycode.F10)
Exemplo n.º 13
0
This driver connects an Atari 130XE keyboard as an
Altirra-compatible PC keyboard

* Author: Bertrand Le Roy
"""

import board
import digitalio
import time
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode

GPIO_BASE = 0xd0000004

keeb = Keyboard(usb_hid.devices)

IN = digitalio.Direction.INPUT
OUT = digitalio.Direction.OUTPUT
PULLUP = digitalio.Pull.UP
PULLDOWN = digitalio.Pull.DOWN


def PinIn(id, pull):
    pin = digitalio.DigitalInOut(getattr(board, 'GP' + str(id)))
    pin.direction = digitalio.Direction.INPUT
    pin.pull = pull
    return pin


def PinOut(id):
Exemplo n.º 14
0
def get_keyboard():
    return Keyboard(hid.devices)
Exemplo n.º 15
0
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.standard.hid import HIDService
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode

hid = HIDService()
advertisement = ProvideServicesAdvertisement(hid)
advertisement.complete_name = 'CIRCUITPY KEYBOARD'
advertisement.appearance = 961
ble = adafruit_ble.BLERadio()
if ble.connected:
    for c in ble.connections:
        c.disconnect()
ble.start_advertising(advertisement)
advertising = True
ble_keyboard = Keyboard(hid.devices)

button = digitalio.DigitalInOut(board.USR_BTN)
button.direction = digitalio.Direction.INPUT
button.pull = digitalio.Pull.UP

last_value = button.value

while True:
    if last_value != button.value:
        last_value = button.value
        print('Button is ' + ('released' if button.value else 'pressed'))
        if ble.connected:
            if not button.value:
                ble_keyboard.press(Keycode.A)
            else: