nano 33 BLE _ seeking a simple Blue Tooth Control project

hi all,

I am seeking a nano 33 BLE project sample to build on the requirements to have a button on a mobile phone, when clicked will turn a digital output ON on the arduino (such as Pin 13) via BLE

thanks in advance for any help

Trajano

search for arduino blue tooth android

dave-in-nj:
search for arduino blue tooth android

thanks for the info
found the sample project, under the arduino IDE
File → Examples → Examples from Custom Libraries
sketch code follows:
/*
Button LED
This example creates a BLE peripheral with service that contains a
characteristic to control an LED and another characteristic that
represents the state of the button.
The circuit:

  • Arduino MKR WiFi 1010, Arduino Uno WiFi Rev2 board, Arduino Nano 33 IoT,
    Arduino Nano 33 BLE, or Arduino Nano 33 BLE Sense board.
  • Button connected to pin 4
    You can use a generic BLE central app, like LightBlue (iOS and Android) or
    nRF Connect (Android), to interact with the services and characteristics
    created in this sketch.
    This example code is in the public domain.
    */
    #include <ArduinoBLE.h>
    const int ledPin = LED_BUILTIN; // set ledPin to on-board LED
    const int buttonPin = 4; // set buttonPin to digital pin 4
    BLEService ledService(“19B10010-E8F2-537E-4F6C-D104768A1214”); // create service
    // create switch characteristic and allow remote device to read and write
    BLEByteCharacteristic ledCharacteristic(“19B10011-E8F2-537E-4F6C-D104768A1214”, BLERead | BLEWrite);
    // create button characteristic and allow remote device to get notifications
    BLEByteCharacteristic buttonCharacteristic(“19B10012-E8F2-537E-4F6C-D104768A1214”, BLERead | BLENotify);
    BLEByteCharacteristic closeButtonCharacteristic(“19B10012-E8F2-537E-4F6C-D104768A1214”, BLERead | BLENotify);
    BLEByteCharacteristic openButtonCharacteristic(“19B10012-E8F2-537E-4F6C-D104768A1214”, BLERead | BLENotify);
    void setup() {
    Serial.begin(9600);
    while (!Serial);
    pinMode(ledPin, OUTPUT); // use the LED as an output
    pinMode(buttonPin, INPUT); // use button pin as an input
    // begin initialization
    if (!BLE.begin()) {
    Serial.println(“starting BLE failed!”);
    while (1);
    }
    // set the local name peripheral advertises
    BLE.setLocalName(“Aberfeldy”);
    // set the UUID for the service this peripheral advertises:
    BLE.setAdvertisedService(ledService);
    // add the characteristics to the service
    ledService.addCharacteristic(ledCharacteristic);
    ledService.addCharacteristic(buttonCharacteristic);
    // add the service
    BLE.addService(ledService);
    ledCharacteristic.writeValue(0);
    buttonCharacteristic.writeValue(0);
    // start advertising
    BLE.advertise();
    Serial.println(“Bluetooth device active, waiting for connections…”);
    }
    void loop() {
    // poll for BLE events
    BLE.poll();
    // read the current button pin state
    char buttonValue = digitalRead(buttonPin);
    // has the value changed since the last read
    boolean buttonChanged = (buttonCharacteristic.value() != buttonValue);
    if (buttonChanged) {
    // button state changed, update characteristics
    ledCharacteristic.writeValue(buttonValue);
    buttonCharacteristic.writeValue(buttonValue);
    }
    if (ledCharacteristic.written() || buttonChanged) {
    // update LED, either central has written to characteristic or button state has changed
    if (ledCharacteristic.value()) {
    Serial.println(“LED on”);
    digitalWrite(ledPin, HIGH);
    } else {
    Serial.println(“LED off”);
    digitalWrite(ledPin, LOW);
    }
    }
    }

anyone know the link to HOW TO USE THIS FORUM ?

simple and concise about subject lines and code tags.

Well, Perry’s link does do that and is pinned at the top of each forum, but the old one which I still use and still works thanks to Nick Gammon, referring to point number 7 in particular, is this.