Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Add Bluetooth BLE scan example #90

Closed

Conversation

svenstaro
Copy link
Contributor

This adds an example for BLE scanning. It doesn't actually set up any GATTs nor does it actually connect via Bluetooth to anything. It merely scans its surroundings for 2 seconds and then continues with the rest of the demo as everything else seemed to verbose to me. I think this is about the simplest Bluetooth example one can currently get away with.

I think this also shows a clear way for how some of the more obvious things could be upstreamed into esp_idf_svc in order to streamline usage in the most common cases. It's a start and I hope it inspires some people to maybe carry the torch. :)

Fixes #85.

@svenstaro svenstaro force-pushed the add-bluetooth-scan-example branch from 44e6719 to 852d7b2 Compare May 17, 2022 02:21
@@ -910,7 +912,7 @@ fn heltec_hello_world(
.init()
.map_err(|e| anyhow::anyhow!("Display error: {:?}", e))?;

led_draw(&mut display)?;
led_draw(&mut display).map_err(|e| anyhow::anyhow!("Display error: {:?}", e))?;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was broken and didn't compile so I drive-by fixed it.

@svenstaro
Copy link
Contributor Author

@ivmarkov I have no idea why this fails to build for this target. For xtensa-esp32-espidf it works just fine. Any idea?

@pyaillet
Copy link
Contributor

Hi !
I tried to fix the problem with esp32c3 in your PR on my own fork, you should be able to see it there.

@kauly
Copy link

kauly commented Sep 22, 2022

To make the bluetooth() function work I had to put the following piece of code at main.rs:

    unsafe {
        esp_idf_sys::nvs_flash_init();
    }

@cwoolum
Copy link

cwoolum commented Oct 25, 2022

image

I'm getting an error that many of the fields on esp_bt_controller_config_t don't exist.

EDIT: @pyaillet 's branch worked for me

@svenstaro
Copy link
Contributor Author

Closing in favor of esp-rs/esp-idf-svc#247.

@svenstaro svenstaro closed this Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an example of bluetooth usage
4 participants