Bluetooth communication error for hex decimal

Hello, I have a Bluetooth BLE 5 volt relay switch/not a arduino board. I am able to connect to device but get error. The communication error, device address not valid. just a need simple on/off switch to turn on light. The relay specifications say hexdecimal parameters:
A0 01 01 A2 RELAY ONE ON
A0 01 00 A1 RELAY ONE OFF

A0 02 01 A3 RELAY 2 ON
A0 02 00 A2 RELAY 2 OFF
Any help with the block or a sample code. Thanks

Search in this Community HM-10 and ESP32 BLE

1 Like

Thank you, I dont see anything but arduino, will this work for this device.

To send these hex sequences, you need to send them as unsigned byte lists.

Here are the equivalent decimal numbers for each byte:

  • A0 = 160
  • 02 = 2
  • 01 = 1
  • 00 = 0
  • A1 = 161
  • A2 = 162
  • A3 = 163

so

  • RELAY ONE ON = 160,1,1,162
  • RELAY ONE OFF = 160,1,0,161
  • RELAY TWO ON = 160,2,1,163
  • RELAY TWO OFF = 160,2,0,162
2 Likes

Here is a sample file that controls a single relay. It uses classic BT but in this case the code for BLE will not differ much. The commands (ON, OFF) can be Block Lists, as shown.

BT_RelaySwitch_01.aia (6.9 KB)

Also attached is a version controlling eight relays:
BT_EDR_8_RelaySwitch.aia (12.7 KB)

1 Like

Thank you much, i will give that a try