This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sending commands to nRF52840 via React Native mobile application

Hi, I've been tasked with sending commands to an nRF52840 Board via a React Native mobile application I've developed, but have no idea how to do so. Our company uses:

  • SEGGER Embedded Studio
  • nRF5 SDK v15.2.0
  • nRF5 SDK for Mesh v 3.0.0
  • S140 and S132 SoftDevices
  • nRF52840 DK
  • nRF52832DK
  • nRF52840 Dongle

I'm developing the React Native application on a Windows 10 machine, and I've installed two different libraries for implementing BLE communication:

  • react-native-ble-manager
  • react-native-ble-plx

I've used both to scan and connect to an nRF52840 device. However once connected, I'm not sure how I can send commands to the board. Additionally, the only time the board shows up on a scan is when I've downloaded an example program to it via SEGGER studio. I'm wondering, is there a generic program I can load onto the board that accepts commands, without security or the need to create a bond or any of the extras. I just want to create a connectable device that receives commands and sends back status information, and I'd like to send commands via one of the BLE communication libraries listed above (react-native-ble-plx or react-native-ble-manager).

Both of these React Native libraries have write functions that take the device ID (typically MAC address), service UUID, and characteristic UUID. I've tried using these libraries to discover the service UUIDs available and the characteristic UUIDs available, and then use those in a write function to attempt writing to the device, but these fail, as the device is loaded with example code from the SDK. I'm pretty sure I can't just send code to, say, a board loaded with the light switch example from the SDK, however the device doesn't even show up in a scan without having example code loaded onto the board... I would greatly appreciate if someone could explain to me how to get a board that is connectable and writeable as described above.

Related