Scanning within an address range

Discussions and questions about the Crazyradio
Post Reply
comathi
Beginner
Posts: 3
Joined: Wed Sep 29, 2021 5:04 am

Scanning within an address range

Post by comathi »

Hello,

I am attempting to control multiple CrazyFlie drones from a single radio. For practical purposes, I am only using two, but in theory I want an arbitrary number of drones to be controlled without having to hardcode addresses for each one of them.

All drones have a similar address, for example 0xE7E7E7E7XX, where XX is unique to each drone.

Is it possible for me to scan the radio interface and obtain the URIs for all drones in the 0xE7E7E7E7XX address range? Or do you know of a different method that would allow me to scan for multiple drones without knowing the precise address beforehand?

Thank you for your help!
jonasdn
Expert
Posts: 132
Joined: Mon Mar 01, 2021 3:13 pm

Re: Scanning within an address range

Post by jonasdn »

Hi comathi!

You could some kind of variant of the code below:

Code: Select all

import cflib.crtp

# Initiate the low level drivers
cflib.crtp.init_drivers()

print('Scanning interfaces for Crazyflies...')

for a in range(7):
    available = cflib.crtp.scan_interfaces(0xe7e7e7e700 + a)
    print('Crazyflies found:')
    for i in available:
        print(i[0])
Jonas
cleoburks
Beginner
Posts: 1
Joined: Tue Apr 05, 2022 3:59 pm

Re: Scanning within an address range

Post by cleoburks »

OK, thanks for the info.
Post Reply