Jordan Klaers
Jordan Klaers

Reputation: 149

No error - sending data from phone app to hm-10 BLE module not working

I have created a react Native app and I am using the react-native-ble-manager library. https://www.npmjs.com/package/react-native-ble-manager

I am using the hm-10 BLE module with an arduino nano, with this code ->

#include <SoftwareSerial.h>
#define LED_PIN 13

SoftwareSerial mySerial(0, 1); // RX, TX  
// Connect HM10      Arduino Uno
//     Pin 1/TXD          Pin 7
//     Pin 2/RXD          Pin 8

void setup() {  
  Serial.begin(9600);
  // If the baudrate of the HM-10 module has been updated,
  // you may need to change 9600 by another value
  // Once you have found the correct baudrate,
  // you can update it using AT+BAUDx command 
  // e.g. AT+BAUD0 for 9600 bauds
  mySerial.begin(9600);
}

void loop() {  
  int c;
  int s;
  if (Serial.available()) {
    s = Serial.read();
    Serial.println("Got other input:");
    Serial.println(c);
  }
  if (mySerial.available()) {
    c = mySerial.read();  
    Serial.println("Got input:");
    Serial.println(c);
  }
}

http://acoptex.com/uploads/HM10ServicesandCharacteristics.pdf

from reading the document above on the HM-10 I am connecting to the third service. In my react app I am able to find and save the service uuid and characteristic uuid that match the docs.

https://github.com/Polidea/react-native-ble-plx/wiki/Characteristic-Writing

from the document above, on the react-native-ble-manager doc for writing to the device I am using this method in my code

deviceObject.writeCharacteristicWithoutResponseForService(writeService, writeChar, encodedString);

I can send data through The arduino serial monitor and the code prints values, but when I send data from my phone app with the method above, no values are printed in the Serial Monitor.

I am not sure where I am going wrong. I have got the phone app to connect and send data to the bluetooth module on an arduino101 but when connecting to the hm-10 with an arduino nano and sending data, nothing happens.

Upvotes: 0

Views: 1337

Answers (1)

Dev_IL
Dev_IL

Reputation: 292

you can check out our side project which uses the same lib to send colors to Arduino and handle LED lights https://github.com/SparingSoftware/HomeLed On Arduino side we are also using Serial ports.

Upvotes: 0

Related Questions