Arduino Function: BLECentralRole.setActiveScan




Function to set if the scan request has to be sent. If so, after receiving an advertising packet from a peripheral, the board will require a further packet to have more information about that peripheral.




  • active: bool. True if the scan request has to be sent, false otherwise.





 Written by Chiara Ruggeri (

 This example for the Arduino Primo board implements the Observer role of the BLE protocol.
 Once scan parameters are set, the sketch continuously listen for advertising packets.

 This example code is in the public domain.

#include "BLECentralRole.h"

// download ArduinoLowPower library from library manager to enter in low power mode
#include "ArduinoLowPower.h"

// create central instance
BLECentralRole bleCentral = BLECentralRole();

void setup() {

 // assign event handler for scanReceived event
 bleCentral.setEventHandler(BLEScanReceived, receiveAdvPck);

 // set scan parameters
 // interval and window in 0.625 ms increments
 bleCentral.setScanInterval(3200); // 2 sec
 bleCentral.setScanWindow(800);  // 0.5 sec

 // timeout in seconds. 0 disables timeout

 // active scan true to ask for scan response packet

 // begin initialization and start scanning

void loop() {
 // since we want to realize a low power application we don't handle the
 // BLE_LED in order to save power but put the board in low power mode instead.

void receiveAdvPck(BLEPeripheralPeer& peer){
 // print the advertising packet received

Written by