Programming for Bluetooth connectivity with Raspberry Pi Pico W in Arduino IDE

I have been having a lot of trouble extablishing a bluetooth connection between my iOS phone and a Raspberry Pi Pico W using bluetooth. I have taken a look at a lot of online resources on the matter but am making little progress.

At this point, I am

  1. Trying to connect the Pico W with my phone through Bluetooth
  2. Trying to Pico connect with and eventually display something on the 'Bluetooth Serial' iOS application.

I tried to do this through two codes:

#include <BluetoothSerial.h>
#include <SerialBT.h>

void setup(){
SerialBT.begin();
}

void loop(){
  for(byte i=0; i<10; i++){
    SerialBT.print(i);
    delay(500);
  }
 }

/*
   Hello_World.ino
   Henry Abrahamsen
   8/12/23
   Simple code using the basic features of Bluetooth Serial
   Details available at https://docs.henhen1227.com/
*/

#include <BluetoothSerial.h>

#define bluetoothModuleSerial Serial1

// Create a BluetoothSerial object
// Serial port that the bluetooth module is connected
// Verbose mode: true
BluetoothSerial blueSerial(bluetoothModuleSerial, true);

void setup() {
  // Start communication with bluetooth device
  bluetoothModuleSerial.begin(9600);
  Serial.begin(9600);

  Serial.println("Setup Complete");
}


void loop() {
  blueSerial.readSerial();

  // If the button with id `B0`
  if (blueSerial.isButtonPressed(0)) {
    Serial.println("The button `B0` has been pressed!");

    // Send alert to the BluetoothSerial Connect App
    blueSerial.sendAlert("Hello from the Arduino");
  }
}

But in both of these cases, I cannot even see the picoW show up in the bluetooth settings of my phone. It came up a couple of times (out of the 100 times I tried) and in both cases when i tried to pair it from the settings, it said the phone does not support this kind of device.

I don't understand what is going wrong. Should I perhaps write the code differently? I can find resources on bluetooth connections with micopython but I am not that familiar with the language and am new to arduino IDE too so I have no idea how to adapt it. All in all, I am pretty lost so I would appreciate all guidance.

Eventually, I would want a button pressed (connected to the pico) to act an an input in an application I made with reactNative which is why it is important to establish a connection of some sort between the pico and the app on the phone. I am open to doing this on wifi too if it is more suitable. All help is appreciated. Thank you all so much.

if I load and run File>Examples>SerialBT>BTSerialUppercase it works OK, e.g.
RP{i Pico W RP2040 connected to Android Bluetooth Terminal app as a Bluetooth Classic device I enter lowercase characters and it echos uppercase

you need to enable
image

This makes sense but it looks like it is only possible with android. This kind of communication is not set up with iOS at all. Do you have any suggestions on how I can use arduino IDE to set up a simple communication between a pico W and a custom app on an iPhone?

I seem to remember that iOS only supports BLE
try File>Examples>KeyboardBLE>BLEserial