Skip to content

toitware/toit-ble-hid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BLE HID

A BLE HID (Human Interface Device) driver.

This package allows you to create BLE HID devices such as keyboards, mice, and tablets. It provides a simple interface to send HID reports over Bluetooth Low Energy (BLE).

Example

import ble-hid
import ble-hid.keys
import gpio

main:
  keyboard := ble-hid.Keyboard --name="Toit Keyboard"
  keyboard.set-battery-level 75

  boot-button := gpio.Pin 0 --input

  print "Waiting for button press"
  // The 'boot' button is connected to GPIO 0 which is a strap pin,
  // pulled high. When pressed, it goes low.
  boot-button.wait-for 0

  // Send key presses, assuming a QWERTY layout.
  keyboard.type-qwerty "Hello big world!"

  keyboard.close

About

A BLE HID (Human Interface Device) driver.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages