Is there any way to make it so that the GPIOs on ADC2 can be read using BLE? Has anyone else run into this issue? I know there are known issues with reading GPIOs on ADC2 while WiFi is enabled, but not necessarily when BLE is enabled. I have tried to turn off WiFi during setup, but including the WiFi.h library makes the binary too large since BLE's library is already massive as is. Below is some super basic GPIO pin polling/reading. If I'm doing something critically wrong, please let me know! Thank you!
Code: Select all
// main.cpp
#ifdef ENABLE_BLUETOOTH
#include "ble.h"
#endif
#include "sensor.h"
#include "helpers.h"
void setupBluetoothPins()
{
for (int i = 0; i < pcbSensorCount; i++)
{
pinMode(pcbPins[i], OUTPUT);
}
}
void bluetoothSensorLoop()
{
for (int i = 0; i < pcbSensorCount; i++)
{
uint8_t val = analogRead(pcbPins[i]);
pcbSensors[i] = (uint8_t)val;
}
setSensorCharacteristic(pcbSensors, pcbSensorCount*sizeof(uint8_t));
}
void loop()
{
while(true) {
bluetoothSensorLoop();
delay(300);
}
}
void setup()
{
// put your setup code here, to run once:
setupPins();
Serial.begin(115200);
#ifdef ENABLE_BLUETOOTH
setupBLE();
#endif
}