Hello!
I recently started using the Arduino Nano 33 IOT for project which requires connecting through bluetooth to an Android App (which I made in MIT App Inventor). But I can't connect it to any other device.
I was able to find it through a BLE scanner app at some point but I couldn't connect. Now I can't even do that.
I will leave my code below, any suggestion will be really appreciated.
(this is not the code for my main project but I am just trying to test the connection).
#include <ArduinoBLE.h>
char c=' ';
BLEService SerialPort ("19B10000-E8F2-537E-4F6C-D104768A1214");
// BLE filter tester/incoming Value Characteristic
BLEUnsignedCharCharacteristic Pressure ("19B10001-E8F2-537E-4F6C-D104768A1214", // standard 16-bit characteristic UUID
BLERead | BLENotify); // remote clients will be able to get notifications if this characteristic changes
void setup()
{
Serial.begin(9600);
Serial.print("Sketch: "); Serial.println(__FILE__);
Serial.print("Uploaded: "); Serial.println(__DATE__);
Serial.println(" ");
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
if (!BLE.begin()) {
Serial.println("starting BLE failed!");
while (1);}
BLE.setLocalName("FILTER TESTER");
// Read from the Bluetooth module and turn the LED on and off
if (Serial.available()>0)
{
c = Serial.read();
Serial.println(c);
// The ascii code for 0 is dec 48
// The ascii code for 1 is dec 49
if ( c== 48) { digitalWrite(LED_BUILTIN, LOW); }
if ( c== 49) { digitalWrite(LED_BUILTIN, HIGH); }
}
}