BleuIO

BleuIO

  • Get Started
  • Buy Now
  • Manual
  • AT Commands
  • Help

›Python library < v1.2.0

Manual

  • How it works
  • How to use
  • Verbose Mode
  • Known Issues
  • Troubleshooting

Firmware Updates

    BleuIO Pro (SSD025)

    • Firmware Updates
    • Release History

    BleuIO (SSD005)

    • Firmware Updates
    • Release History of BleuIO (SSD005)

AT-Commands

  • List of AT Commands

BleuIO Libraries

  • JavaScript Library
  • Python Library

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

Projects

    Arduino

    • Arduino Example

    Beaglebone

    • Beaglebone Example

    Raspberry Pi

    • Raspberry PI into Beacon
    • Raspberry PI home automation

    Raspberry PI Pico

    • BleuIO integration (Part1)
    • BleuIO integration (Part2)
    • BleuIO integration (Part3)

    Renesas RA4M2

    • Signal Strength Monitoring
    • Real-Time CO2 monitor
    • Monitoring Air Quality

    STM32 Nucleo-144

    • Nucleo-144 board example
    • Smart Bulb Example

    M5Stack's CoreMP135

    • M5Stack's CoreMP135 board example

Build Your Own Firmware

  • Build Your Own Firmware
  • Advertising Example

More

  • Links
Order Now

BleuIO

$19.99

Buy Now

Scan and store example using Python library

Introduction

In this example, we're going to set up the dongle using Python script to scan for nearby Bluetooth devices with a Manufacturer Specific (MFS) ID and then store the results together with a timestamp and the MAC Address in a simple text file.

from datetime import datetime

from bleuio_lib.bleuio_funcs import BleuIo

# from serial import SerialException
from time import sleep

my_dongle = BleuIo()
my_dongle.start_daemon()

print(
    "Connected to dongle\n\n"
    "Welcome to the Bluetooth device Scan and Store example!\n\n"
)

# Set the dongle in central role
my_dongle.at_central()

user_input = input(
    "Enter something such as a Manufacturer Specific (MFS) ID to scan for "
    "and store in a file or just leave it blank to scan all:\n"
)

# Scans with a specific id or all devices if none is provided
my_dongle.at_findscandata(user_input)

log = ""

while user_input.casefold() != "stop":
    user_input = input('Enter "STOP" to stop scanning\n')
    # If the user stops the scan log reformat and log the response
    if user_input.casefold() == "stop":

        # Stop the scan
        my_dongle.stop_scan()

        # Fetch the result
        log = my_dongle.rx_scanning_results

# Saves the log to scan_log.txt
with open("scan_log.txt", "w") as scan_log:
    for line in log:
        scan_log.write(line)

Full source also available on GitHub.


← Scan example using Python librarySPS example using Python library →
  • Introduction

Support Request

If you have any queries or technical questions, please don't hesitate to send us a message. We will reply within 24 hours.

Message Sent!

Docs
ManualAT CommandsHelp
Community
YouTubeLinkedInFacebook
More
BleuIOSmart Sensor DevicesGitHub
Sales & Support
support@bleuio.comsales@bleuio.com
Copyright © 2025 BleuIO. A product of Smart Sensor Devices