Rak3172 adc battery

About the function
Serial.println(api.system.bat.get());
Is it possible to modify it to read another ADC that 1 ?

That is not possible at the moment and api.system.bat.get() works only if you have actually a circuit that can read the battery voltage.

You can use the Analog IO functions to read from another analog pin.

thank you so much!

One more question Beegee

how can i a do on arduino to detect this message ?
“+EVT:LINKCHECK:0:26:1:-28:8”
For example, if he link is down, the event not occurs

void receiveCallback(SERVICE_LORA_RECEIVE_T *data)

{

  MYLOG("RX-CB", "RX, port %d, DR %d, RSSI %d, SNR %d", data->Port, data->RxDatarate, data->Rssi, data->Snr);

  for (int i = 0; i < data->BufferSize; i++)

  {

    Serial.printf("%02X", data->Buffer[i]);

  }

  Serial.print("\r\n");

  tx_active = false;

}

i need to detect this message

+EVT:LINKCHECK:1:0:0:0:0****strong text

There is no callback, but you can check the result in the RX callback with api.lorawan.linkcheck.get();

i changed the software…
but it´s always returning 0

[UPLINK] Sending packet...

[UPLINK] Packet enqueued, size 6

Network link status = 0

Network link status = 0

Network link status = 0

Network link status = 0

[TX-CB] TX status 0

+EVT:TX_DONE

+EVT:LINKCHECK:0:25:1:-29:8

[RX-CB] RX, port 0, DR 10, RSSI -29, SNR 8

Network link status = 0 <---------------------

if i power off the lora gateway

[UPLINK] Start

92539

3.29

[UPLINK] Sending packet...

[UPLINK] Packet enqueued, size 6

Network link status = 0

Network link status = 0

Network link status = 0

Network link status = 0

Network link status = 0

Network link status = 0

Network link status = 0

[TX-CB] TX status 0

+EVT:TX_DONE

+EVT:LINKCHECK:1:0:0:0:0

Network link status = 0

i would like to get acess to the +EVT:LINKCHECK values :x:X:X:X:X

void loop()

{

  api.system.sleep.all();

  // api.system.scheduler.task.destroy();

   Serial.printf("Network link status = %d\r\n", api.lorawan.linkcheck.get());

}

The third and forth value are in the RX callback value, the second one is not available with the API at the moment.

yes, i agree, but if you POWER off the GATEWAY MODEM, you can´t get the
[RX-CB] event to get that values…

I want to detect if the GATEWAY is OFF

to solve temporarily, i had to include on service_lora.c

extern bool LINKCHECK_ERROR;

and

case MLME_LINK_CHECK:
{
linkcheck_flag = 1;
DemodMargin = mlmeConfirm->DemodMargin;
NbGateways = mlmeConfirm->NbGateways;
linkcheck_state = mlmeConfirm->Status;
if(linkcheck_state!= LORAMAC_EVENT_INFO_STATUS_OK)
{
udrv_serial_log_printf("+EVT:LINKCHECK:1:0:0:0:0\r\n");
//miguel
LINKCHECK_ERROR = 1;
}
break;
}

and on main Arduino code

bool LINKCHECK_ERROR = 0;

And monitor that…