BleuIO

BleuIO

  • Back to Site
  • Buy Now
  • Manual
  • AT Commands
  • Help

›Python library > v1.2.0

Manual

  • How it works
  • How to use
  • Verbose Mode
  • Known Issues
  • Firmware Updates
  • Release History
  • Troubleshooting

AT-Commands

  • List of AT Commands

Scripts & Tutorials

  • Python: iBeacon
  • Python: Eddystone Beacon
  • Python: Scan
  • Python: Scan and Store
  • Python: SPS Script
  • Python: File transfer Script
  • Python: Repeater Script
  • Javascript: Google chrome.serial Beacon
  • C# Console App Example
  • C# WFA Example

Script using libraries

    Python library > v1.2.0

    • Custom Services example using Python library
    • Eddystone example using Python library
    • IBeacon example using Python library
    • Scan example using Python library
    • Scan and store example using Python library

    Python library < v1.2.0

    • Eddystone example using Python library
    • IBeacon example using Python library
    • Scan example using Python library
    • Scan and store example using Python library
    • SPS example using Python library
    • Security Example using Python library

    JS library

    • Eddystone example using Javascript library
    • IBeacon example using Javascript library
    • Scan example using Javascript library
    • Security Example using Javascript library
    • Get Device Distance

    Nodejs library

    • Scan example using Nodejs library

STM32 Example

  • STM32 Example
  • Smart Bulb Example

Arduino Example

  • Arduino Example

Beaglebone Example

  • Beaglebone Example

Build Your Own Firmware

  • Build Your Own Firmware
  • Advertising Example

More

  • Links

Scan example using Python library

Introduction

In this example, we're going to set up the dongle using the following Python script to scan for nearby Bluetooth devices.

This script will work on BleuIO Python library 1.2.0 or above

from bleuio_lib.bleuio_funcs import BleuIO
import time

# This is an example script showing how to scan for nearby bluetooth devices using BleuIO's Python library

# Creating a callback function for scan results. For this example we just prints out the result.
# Here you can add your code to parse the data.
def my_scan_callback(scan_input):
    print("\n\nmy_evt_callback: " + str(scan_input))

# Auto-Detect dongle
my_dongle = BleuIO()
# Registers the callback functions we created earlier.
my_dongle.register_scan_cb(my_scan_callback)

print("Scan for nearby Bluetooth devices using BleuIO Python Library!\n")
# Now we start scanning
# First we need to put the dongle in Central or Dual Gap Role
my_dongle.at_dual()

# We send in a timeout as a parameter for the at_gapscan() command. In that case it will scan for 3 seconds.
# Here we just set a three second sleep.
# Notice that all the scan data will be printed by our my_scan_callback() function.
resp = my_dongle.at_gapscan(3)
time.sleep(3)

print("\n--\n")

Full source also available on GitHub.


← IBeacon example using Python libraryScan and store example using Python library →
  • Introduction
Docs
ManualAT CommandsHelp
Community
YouTubeLinkedInFacebook
More
BleuIOSmart Sensor DevicesGitHub
Copyright © 2023 BleuIO. A product of Smart Sensor Devices