Skip to content

Add new Bluetooth examples. #693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ These networking examples are only available if Wi-Fi is supported by the board.
App|Description
---|---
[picow_access_point](pico_w/wifi/access_point) | Starts a WiFi access point, and fields DHCP requests.
[picow_access_point_wifi_provisioning](pico_w/wifi/access_point_wifi_provisioning) | Starts a WiFi access point, and allows WiFi credentials to be provisioned through a web page.
[picow_blink](pico_w/wifi/blink) | Blinks the on-board LED (which is connected via the WiFi chip).
[picow_blink_slow_clock](pico_w/wifi/blink) | Blinks the on-board LED (which is connected via the WiFi chip) with a slower system clock to show how to reconfigure communication with the WiFi chip at run time under those circumstances.
[picow_blink_fast_clock](pico_w/wifi/blink) | Blinks the on-board LED (which is connected via the WiFi chip) with a faster system clock to show how to reconfigure communication with the WiFi chip at build time under those circumstances.
Expand Down Expand Up @@ -296,8 +297,11 @@ Some standalone Bluetooth examples (without all the common example build infrast
App|Description
---|---
[picow_ble_temp_sensor](pico_w/bt/standalone) | Reads from the on board temperature sensor and sends notifications via BLE.
[picow_ble_temp_sensor_with_wifi](pico_w/bt/standalone) | Same as above but also connects to Wi-Fi and starts an "iperf" server.
[picow_ble_temp_reader](pico_w/bt/standalone) | Connects to one of the above "sensors" and reads the temperature.
[picow_ble_temp_reader](pico_w/bt/standalone) | Connects to the above sensor and reads the temperature.
[picow_ble_pointer](pico_w/bt/standalone/ble_pointer) | Bluetooth HID mouse using mpu6050 to detect angle and move cursor.
[picow_ble_doorbell](pico_w/bt/standalone/doorbell) | Detects button press on transmitter Pico and illuminates LED on reciever Pico.
[picow_ble_secure_temp_sensor](pico_w/bt/standalone/secure_temp_sensor) | Variant of picow_ble_temp_sensor which allows exploration of LE_secure configurations.
[picow_ble_wifi_provisioner](pico_w/bt/standalone/wifi_provisioner) | Allows WiFi credentials to be provisioned over BLE, either using a mobile app or with the included python script.

### PIO

Expand Down
8 changes: 6 additions & 2 deletions pico_w/bt/standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
add_subdirectory(client)
add_subdirectory(server)
add_subdirectory(secure_temp_sensor)
add_subdirectory(doorbell)
add_subdirectory(wifi_provisioner)
add_subdirectory(ble_pointer)
add_subdirectory(temp_sensor)

37 changes: 37 additions & 0 deletions pico_w/bt/standalone/ble_pointer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Add mpu6050 libary
add_library(mpu6050_i2c_lib INTERFACE)
target_sources(mpu6050_i2c_lib INTERFACE
${CMAKE_CURRENT_LIST_DIR}/mpu6050_i2c_lib.c
)
target_include_directories(mpu6050_i2c_lib INTERFACE
${CMAKE_CURRENT_LIST_DIR}
)
target_link_libraries(mpu6050_i2c_lib INTERFACE
pico_stdlib
hardware_i2c
)

# Add executable. Default name is the project name, version 0.1
add_executable(ble_pointer
ble_pointer.c
)

# Add the standard library to the build
target_link_libraries(ble_pointer
pico_stdlib
pico_btstack_ble
pico_btstack_cyw43
pico_cyw43_arch_none
mpu6050_i2c_lib
)

# Add the standard include files to the build
target_include_directories(ble_pointer PRIVATE
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/..
)

pico_btstack_make_gatt_header(ble_pointer PRIVATE "${CMAKE_CURRENT_LIST_DIR}/ble_pointer.gatt")

pico_add_extra_outputs(ble_pointer)

7 changes: 7 additions & 0 deletions pico_w/bt/standalone/ble_pointer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### BLE pointer

This example is based on BTstack's 'hog_mouse_demo' and demonstrates a Bluetooth HID mouse. Cursor position is controlled by mpu6050 angle measurements, allowing you to point at the screen and move the mouse cursor.

To use this example connect a mpu6050 (which can be found at https://thepihut.com/products/6-dof-sensor-mpu6050) to the pico, with SDA connected to pin 4 and SCL connected to pin 5. Also, connect 2 buttons to pins 15 and 16 for left and right click.

Once powered, you should be able to pair your computer with 'HID Mouse' and use the pointer.
Loading