Communication problem

Hello, I'm trying to send string from NICLA SENSE to Arduino UNO via the TX/RX.
there are the codes:

//Slave code
void setup() 
{
    Serial.begin(9600);  
   
    while (!Serial) {  ;  }
}
 
 
void loop() 
{
  Serial.print(1);
  delay(1000);
   Serial.print(10);
   delay(1000);
}
//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

How I solve it?
Thanks !

You use

but don't send "\n" in any form

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 ????

look at the pic:
image

I see you didn't understand my first message.

I repeat in plain text, as for a child - in the sketch for Nicla, replace the print with println

I tried, but again,the UNO print ??? and other wrong chars.
image

Maybe its related to volt differences? I dont know what to think because with 2 UNO's it worked but with NICLA SENSE ME it doesn't

Why did you inserted this line?

Are you connected GND lines of both arduinos?

Hello!
You may need to receive the data as a integrer, you are printing the character number 1, and the the character number 10

Try using Serial.parseInt() instead of Serial.read()

Check this out

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 do not hijack other's thread, start a new one

Hello everyone,

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.

Best,

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,

See RX/TX example code from here and bump up the Serial1 baud rate - https://docs.arduino.cc/learn/communication/uart/#rxtx-pin-examples

void setup() {
  Serial1.begin(31250); //baud rate for RX/TX data transfer
  Serial.begin(9600); //baud rate for regular serial

Why does it work at 31250? I have no idea but I'm sleepy now

Reference links -
Board Comparison: List of Arduino boards and compatible systems - Wikipedia

Arduino Due: