HM-10. BLE. Arduino UNO. Notify. Bluetooth. AT. iBeacon. Arrhythmia

11.- WriteBytes and WriteStrings.

p110i_UNO_hm10_WriteBytes.aia (199.2 KB)

  • We convert text list
    ["65","66","67","68","69","70"]
    to number list_n.
    [65,66,67,68,69,70]

Send this list_n with "WriteBytes".

We can also send with "WriteStrings".

  • Notice that WriteStrings adds the NULL character. If you want to avoid it, use the NullTerminateStrings block.
// Juan A. Villalpando
// http://kio4.com/arduino/161_HM10_BLE.htm

#include <SoftwareSerial.h>
// El TXD del módulo al pin 2 (RX) del Arduino.
// El RXD del módulo al pin 3 (TX) del Arduino.
SoftwareSerial HM10(2, 3);

byte caracter = "";  
// char caracter = ' ';  

void setup(){
  Serial.begin(9600);
  HM10.begin(9600);
}

void loop(){
  if(HM10.available()) { 
  caracter = HM10.read();
  Serial.println(caracter); 
   }
} 

1 Like