Pages: [1]   Go Down
Author Topic: c++ visual studio form application serially reading data from arduino  (Read 459 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi!

iv made a c++ form application using visual studio. i want to read a string, serially printed/transmitted from my arduino mega and show the string on a text box in my form application. i have tried ReadLine() and a few other functions but I am unable to do so.

this is the arduino code:
Code:
String str;

void setup()
{
  Serial.begin(9600);
 
}

void loop()
{
  Serial.println("hello");
  delay(2000);
}

i have inserted a text box and a button on my form application. i want the hello to be saved in a string and want it to appear on the text box.
(or if therez a way to serially read characters, that can do my job too)

need help with the c++ code for the form application for this :/ any kind of help will be appreciated!
Logged

Cincinnati, OH
Offline Offline
God Member
*****
Karma: 48
Posts: 812
I'm not bossy...I just know what you should be doing.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've not experimented with this class, but see if this might help:

http://www.codeguru.com/cpp/i-n/network/serialcommunications/article.php/c2503/CSerial--A-C-Class-for-Serial-Communications.htm
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 615
Posts: 49388
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
need help with the c++ code for the form application for this
But you have not shown any code for the PC side.

Frankly, C++ is a crappy way to build forms applications that deal with the serial port (or that don't, for that matter).

C# makes developing forms apps so much simpler, and reading and writing from the serial port is trivial. Check out the attached application, if you want to go the easy route.

* CommunicateWithArduino.zip (53.99 KB - downloaded 5 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thankyou econjack and PaulS for your help! i will surely try these methods
Logged

Pages: [1]   Go Up
Jump to: