ArduinoCore-nRF528x-mbedos
ArduinoCore-nRF528x-mbedos copied to clipboard
More than 3 concurrent BLE Connections (Arduino Nano 33 BLE)
Hi everyone, I would like to have more than 3 concurrent BLE connections with the Arduino Nano 33 BLE. As far as i understand i have to adjust the DM_CONN_MAX in cfg_stack.h.
Unfortunately, that doesn't work, do you have any tips on what I'm doing wrong? Thanks and kind regards!
Hello @dhalbert , i modified your text and it seems to be working :
void setup()
{
Serial.begin(9600);
pinMode(A0, INPUT);
}
void loop() {
// Attach A0 to 3.3V through a 220K or other high-value resistor,
// so it's not stronger than the driven output.
delay(100);
Serial.println(analogRead(A0));
delay(100);
Serial.println("Done");
}
the problem is still the same with touchsceen... but i'm wondering if it's not just about a pins definition problem ?
@MattGlobal In the example you gave, there is no pinMode()
between analogRead()
calls. In my example, the pin usage alternates between pinMode()
and analogRead()
. My hypothesis is that the second call to analogRead()
is assuming the pin is already set up where as in fact its settings where changed "behind the back" of analogRead()
.
Here is the impl:
https://github.com/arduino/ArduinoCore-mbed/blob/68fbece79947ce2a64bf49f7ba5f5f8111d89454/cores/arduino/wiring_analog.cpp#L101-L121
The first time through, a new mbed::AnalogIn
object is created. That's reused on subsequent calls.
A workaround might be to call analogUpdate()
before every call to analogRead()
. I'll try that. (EDIT: ANALOG_CONFIG
isn't defined, so analogUpdate()
is not included, so it requires some surgery in the sources, which is not a clean workaround for the average user.) But there's an assumption being made in the code in this file that the pin state is not changing out from under analogRead()
.