user3073809
user3073809

Reputation: 3

How to get RSSI on the BLE112 by Bluegiga

in the program for BLE112 I measure RSSI and then turn ON the LEDs. I have written a program for this purposes. I get RSSI and if the value is more then -70 dBm I turn on the LEDs in P_03 and P_04, and if the value is less then -70 dBm the LEDs are OFF. But there is a problem: when I flash my module all is OK - the LEDs are OFF, but when I connect my phone with BLE112 the LEDs turn on and that's all! They don't respond to the statements of RSSI. I can't find out any information about this problem, so I decide to ask you about this problem. I attach my project. And this is part of code where I get RSSI and set to high PINs:

event hardware_soft_timer(handle)
if ( connected )
call connection_get_rssi(active_connection)(ret_connection, ret_rssi)
if ( ret_rssi > -80 )
call hardware_io_port_write(0, $18, $18)
else
call hardware_io_port_write(0, $18, 00)
end if
end if

Upvotes: 0

Views: 1381

Answers (1)

CZorio
CZorio

Reputation: 26

"The "int8" data type is a signed (two's complement) 8-bit integer, which means that practically speaking, 0-127 represent those actual values, and 128 to 255 represent -128 to -1, respectively. Since RSSI values are always negative on the BLE, that means that the mathematical integer representation of -50, for example, will actually be 205." - Jeff Rowberg.

Do the following:

#Get RSSI value of connection
call connection_get_rssi(connection_handle)(connection_handle,rssi)     
#Convert ASCII into integer
rssi = $100 - rssi

    #if device is within range...
    if rssi >= 80 then...

Oh..$100 is 256 in hex. You can simply use 256 will still work.

Upvotes: 1

Related Questions