I am using nrf52840 sense. Using non mbed board. With the code below and using a multimeter I am getting 7mA current draw. This seems too high. Is there a way to optimize?
#include <bluefruit.h>
#include <Adafruit_FlashTransport.h>
#include <nrf_sdm.h>
#include <nrf_power.h>
BLEService uploadService("4fafc201-1fb5-459e-8fcc-c5c9c331914b");
BLECharacteristic dataCharacteristic("aeab4b05-a5fd-4c89-89de-17f1509e2734");
BLECharacteristic batteryLevelChar("9f83442c-7da2-49ca-94e3-b06201a58508", BLERead | BLENotify);
BLECharacteristic batteryStateChar("2BED", BLERead | BLENotify);
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
Bluefruit.autoConnLed(false);
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.setName("Test");
Bluefruit.begin();
Bluefruit.setName("Test");
Bluefruit.setTxPower(4);
// Bluefruit.Periph.setConnectCallback(connect_callback);
// Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
Bluefruit.Periph.setConnInterval(24, 60);
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.configUuid128Count(15);
uploadService.begin();
dataCharacteristic.setProperties(CHR_PROPS_NOTIFY);
dataCharacteristic.setFixedLen(247);
dataCharacteristic.begin();
batteryLevelChar.begin();
batteryStateChar.begin();
Bluefruit.Advertising.addService(uploadService);
Bluefruit.Advertising.restartOnDisconnect(true);
Bluefruit.Advertising.addName();
Bluefruit.Advertising.setIntervalMS(100, 153); // in unit of 0.625 ms
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
Bluefruit.Advertising.start(0);
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
}
// the loop function runs over and over again forever
void loop() {
}