I tried to make a UART communication between a Arduino Mega and a Nicla Sense Me and after exactly 51 seconds the Arduino stops to received the information of the Nicla, I don´t know what is wrong.
After searching I en the middle of the process between the ground and the 5 volts I put a capacitor of 100 uF and the Arduino keep the communication indefinitely.
void setup() {
// Open serial communications and wait for port to open:
pinMode(LED_BUILTIN, OUTPUT);
Serial2.begin(9600, SERIAL_8N1);
delay(500);
}
void loop() { // run over and over
while(Serial2.available()){
delay(2);
char NiclaS = Serial2.read();
String ValN = String (NiclaS);
switch (tolower(ValN[0])){
case '1':
digitalWrite(LED_BUILTIN, HIGH);
Serial2.flush();
break;
case '2':
digitalWrite(LED_BUILTIN, LOW);
Serial2.flush();
break;
}
}
}
**I am trying to communicate a Nicla SENSE ME with an Arduino Uno through SPI, I2C, and UART, and in none of the cases has it been possible. The Nicla Sense seems to have a different encoding for each standard (it is supposed to be standard but it is not for the Nicla Sense - it seems that Bosch complicates everything and they do not respond in their forums). For this reason, I want to know if someone has already solved this problem, or how to file a formal complaint.