//Slave code
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available()) {
String command = Serial.readStringUntil('\n'); // Read the command until a newline character is received
command.trim(); // Remove leading and trailing whitespaces
Serial.println(command);
Serial.println(Serial.read());
}
}
when I check the Serial Monitor of the Arduino UNO I see nothing,
The NICLA is sending the string but the UNO doesnt get anything
When I tried this concept with 2 Arduino UNO it worked.
I also tried to change it to Serial.readString() but it didn't work either..
Now the problem that there is a communication but the UNO printing ????
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.
Please consider the two lines below in the sketch uploaded to the Nicla Sense ME board:
#include "Nicla_System.h" // At the beginning of the sketch
nicla::begin(); // In the Setup section to initialize the board
When setting up UART communication, if the data received by the second board is randomly corrupted or appears in this form '��l� ��rld!��', please check:
Baud rate consistency in both sketches (transmitter and receiver).
Potential poor contact between wires and TX/RX pins.
I feel your pain @roeibar22. Unfortunately, everywhere online talks about the voltages being different -> 5V in the UNO vs 3.3V in the Nicla.
Since UART is based on high-low voltage signals, the UNO and Nicla cant tell what the other one is even trying to say. I gave up weeks ago but if you can get it to work lmk <3.
One post somewhere said users could use a voltage divider but if you are going to implement UART in a project you probably don't want the extra set-up step and then on top of that there's the unknown-unknown possibility of dirty signal.
I say be glad you got the connection to work with UNO->UNO, cut your losses, and get an Arduino Nano. They have a bunch of variations. I got the Nano BLE Connect after my own personal struggle.
If you still want a big board they have the Arduino Due which is 3.3V.
Ironically it is one of Arduino's first boards and I'm surprised its not cheaper tbh.
ALSO BIG NOTE
It's 1am and I just happened to fall into this post thanks to hamza_pro's reply in another post about baud rate. (<3 you @hamza_pro)
Dont ask me why but nothing worked when connecting my Nano to my Nicla until I increased my Serial1 baud rate to 31250. I might make another post about it,