🛠 Le Bluetooth Low Energy embarqué, vu depuis le croquis

Arduino Tian (id: tian) · avance · Schéma : IMG-tian-avance-2-tian-ble-bridge.svg — Arduino Tian au centre, un smartphone et un capteur BLE autour avec des ondes 2,4 GHz, flèche interne « module BLE -> Linux -> Bridge -> SAMD21 », terminal affichant une liste de périphériques découverts.

Objectives

Use the Bluetooth Low Energy module integrated into the Tian — the board was announced as a pioneer: it was one of the first Arduinos with embedded BLE. Typical architecture of the board: the radio module is on the Linux side, and the sketch accesses it through the Bridge. You will list the BLE peripherals visible from the SAMD21, then decide which side of the board deserves this work.

Hardware

Complete code

// Demander à Linux son environnement BLE via le Bridge.
#include <Bridge.h>

void setup {
  Serial.begin(9600);
  while (!Serial) { }
  Bridge.begin;
  delay(2000);   // laisser le service BLE côté Linux s'initialiser
}

void loop {
  // L'API dédiée au BLE passe par le Bridge de la Tian.
  // > 
  // (getBLE / exemples d'usine du package de carte) : valider avec
  // l'exemple BLE fourni, la doc officielle archivée étant la référence.
  BridgeProcess p = Bridge.runShellCommand("hcitool lescan --duplicates");
  // Lecture non bloquante de la sortie du scan côté Linux.
  String line;
  while (p.available && (line = p.readStringUntil('\n')).length) {
    Serial.println(line);   // adresse + nom des périphériques détectés
  }
  delay(10000);
}

Expected verification

The Serial Monitor displays lines like “AD:RS:ES:S1:BL:E Device-Name” as scans proceed: the SAMD21 has just made the Linux BLE stack work without knowing a single thing about radio. Turn off the sensor: it disappears from subsequent scans.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials