Cannot read the Data from my Arduino Nano

Good day everyone,
I'm very new to this Arduino programming. But I already have a problem and cannot find an answer.
I hope someone can help.

I am using the Arduino Nano and have connected a temperatur sensor to it. When I open the Arduino Desktop App i can see that Data is being send through the "Serial Monitor".

I have now programmed a little programm with visual studio to read the data and have it shown on the screen.
But he never recieves any data. The problem is not the code ( I have checked with a friend, where it works ).

Maybe I have to activate something on my PC? Maybe Enable something? We are pretty helpless as to where the problem is.

Thanks for your help
:slight_smile:

The problem is not the code

The problem is in one of three places - the code on the Arduino, the code on the PC, or the hardware.

I have checked with a friend, where it works

Well, that rules out the hardware then.

So, your initial assertion is false.

No, what I meant was that it works on his PC. But unfortunately not on mine.
What I did was, he send me his working exe. Started it on my PC but while it works on his
it doesnt work on mine.

How about the Arduinos are on different com ports (for the different PCs) and the exe uses a hard-coded comport?

No, the COM Port is not hard coded.
In the program it is on COM 4 and in the Arduino Desktop App Programm it is also on COM 4 and it works

Dirichlet92:
No, what I meant was that it works on his PC.

How could he test the programm with your Arduino?

He had the Arduino I am using now before. And now he is trying it with a different Arduino.
So I might have to change a setting on my arduino?

I have no idea. :confused:

Okay, haha :slight_smile: But thanks a lot for trying

Dirichlet92:
No, the COM Port is not hard coded.
In the program it is on COM 4 and in the Arduino Desktop App Programm it is also on COM 4 and it works

Do you have aerial monitor open while testing the exe? You are aware that only one application can use the serial port at a time.

No, the serial monitor is closed. I even closed the Arduino Desktop App just to make sure.

Here's a thought...post the code.

This is the Visual Studio Code, where it gets interesting. I hope it helps

//Read Button

private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
// check if port is ready for reading
if (this->serialPort1->IsOpen) {
// Reset the text in the result label.
this->textBox1->Text = String::Empty;

// this will read manually
try {
this->textBox1->Text = this->serialPort1->ReadLine();
}
catch (TimeoutException^) {
this->textBox1->Text = "Timeout Exception";
}
// Disable the init button
// the asynchronous operation is done.
this->button1->Enabled = false;
}
else
// give error warning
this->textBox1->Text = "Port Not Opened";

where it gets interesting.

That snippet of code is what reads from the port, if it is open, in response to a button click.

I can not imagine why reading incoming serial data is dependent on the user having to click a button. I really can not imagine why the author couldn't be bothered to give the button a meaningful name. There isn't a hope in hell of understanding what button 4 is supposed to do.

As it is written above, it is the "read button".
This simple piece of code was for me to get a signal from the Arduino if I press the "read"/"button4".
And once the button is clicked the value given from the Arduino is supposed to appear in the text box.