Go Down

Topic: cannot read the data from arduino to the c# (Read 5943 times) previous topic - next topic

jjspierx

At a quick glance it looks ok to me, is it working?

it is not working for serial part..n the latlong transmitted cannot be displayed in the label in c# winform.

this is my snippet of coding for arduino..
Code: [Select]
float rate, waterlevel,longitude,latitude;
...if (latitude== 3.8463 && longitude==103.3059)
{serial.print("latitude:");
serial.println(latitude,4);
serial.print("longitude:");
serial.println(longitude,4);


why i cannot pun the value of latitude and longitude into the label on the winform?

jjspierx

Without seeing your C# code or a more detailed description of the problem,  I cannot help you as I do not understand what the problem is.

PaulS

Quote
why i cannot pun the value of latitude and longitude into the label on the winform?

You can, if you do it right. Are you (properly) using separate threads for the serial and UI activities?


There are some examples on stackexchange and perhaps also on the arduino forum. That being said, I attached a small project with a multiline textbox that receives messages from the serial interface (as well as a dropdown to select and connect with the proper COM) It should be easily modifiable for your purposes.

how to seperate the the thread from UI, PaulS?sorry for asking as im new in c#...from the search in the tutorial, it seems that i have to use the backgroundworker code..how i use that in proper manner?


PaulS

I've attached a C# application that communicates with the Arduino, using separate threads for the UI and the serial data handling.

It should give you some clues.

Go Up