Bluetooth Serial Connect Docs
First working board

Tap a button and update a display

Use the bundled Hello World board when you want the fastest proof that the app, BLE module, and Arduino sketch are talking.

Checklist

  1. Install the Arduino library

    Install Bluetooth Serial Connect from Library Manager, or add the ZIP from this repo.

  2. Wire the BLE module

    Cross TX/RX, share GND, and power the module at the voltage printed on its board or datasheet.

  3. Open the Hello World template

    In the app, go to Templates -> Examples -> Hello World. It uses Button 0 and Text Display 0.

  4. Upload the sketch

    Use the example below. If your board has no Serial1, use the No_Serial1 or Software_Serial example instead.

  5. Connect and tap

    Connect to the BLE module from a physical iPhone or iPad, then tap Button 0. The app should show the press count.

Hello World sketch
#include <BluetoothSerialConnect.h>

BluetoothSerialConnect serialConnect(Serial1, true);

int pressCount = 0;

void setup() {
  Serial.begin(9600);
  serialConnect.begin(9600);
  Serial.println("Setup complete");
}

void loop() {
  serialConnect.readSerial();

  // Button B0 was just pressed.
  if (serialConnect.wasButtonPressed(0)) {
    pressCount++;
    serialConnect.sendAlert("Hello from the Arduino!");
    serialConnect.setDisplay(String("Presses: ") + pressCount, 0);
  }

  // Text typed in the app console.
  if (serialConnect.hasMessage()) {
    serialConnect.setDisplay(serialConnect.getMessage(), 0);
  }
}