Welcome to Dream.In.Code
Become a C# Expert!

Join 150,365 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,805 people online right now. Registration is fast and FREE... Join Now!




SerialPort

 
Reply to this topicStart new topic

SerialPort

dragonuv
18 Feb, 2008 - 07:03 AM
Post #1

New D.I.C Head
*

Joined: 18 Feb, 2008
Posts: 3

Hi, I'm interested in making my project in c# for the next semester combining electronics.
my friend told me that there is a control called serialPort1 which can send and receive signals to the COM1 output from the computer.
my questions are where is that output? and how can i use it?
and can I use a USB output? using that control?
Please don't throw rocks at me, i have never dealt with hardware before rolleyes.gif
thanks very much smile.gif
User is offlineProfile CardPM
+Quote Post

Nayana
RE: SerialPort
18 Feb, 2008 - 07:30 PM
Post #2

DIC Hawk - 나야나 नयन:
Group Icon

Joined: 14 Nov, 2007
Posts: 824



Thanked: 5 times
Dream Kudos: 175
My Contributions
It really depends on whether the device you're connecting to can understand serial data or not.

It would probably help better if you told us exactly what you're trying to do, then we could suggest the best method.

I.e. What device are you trying to connect to?
How is it possible to electronically control that device?
User is offlineProfile CardPM
+Quote Post

dragonuv
RE: SerialPort
19 Feb, 2008 - 06:12 AM
Post #3

New D.I.C Head
*

Joined: 18 Feb, 2008
Posts: 3

QUOTE(Nayana @ 18 Feb, 2008 - 08:30 PM) *

It really depends on whether the device you're connecting to can understand serial data or not.

It would probably help better if you told us exactly what you're trying to do, then we could suggest the best method.

I.e. What device are you trying to connect to?
How is it possible to electronically control that device?


I'm trying to connect a device called Arduino (http://www.ladyada.net/learn/arduino/index.html)
there is a tutorial in how to control it using c++, but im looking for a way to use it using c#.
thanks smile.gif
User is offlineProfile CardPM
+Quote Post

killnine
RE: SerialPort
19 Feb, 2008 - 07:21 AM
Post #4

D.I.C Head
**

Joined: 12 Feb, 2007
Posts: 114



Thanked: 5 times
My Contributions
QUOTE(dragonuv @ 19 Feb, 2008 - 07:12 AM) *

QUOTE(Nayana @ 18 Feb, 2008 - 08:30 PM) *

It really depends on whether the device you're connecting to can understand serial data or not.

It would probably help better if you told us exactly what you're trying to do, then we could suggest the best method.

I.e. What device are you trying to connect to?
How is it possible to electronically control that device?


I'm trying to connect a device called Arduino (http://www.ladyada.net/learn/arduino/index.html)
there is a tutorial in how to control it using c++, but im looking for a way to use it using c#.
thanks smile.gif



I can't get to the site you linked here at work, but my guess is that if the device has existing C++ in the form of source code or (dare'st I say it) DLLs, you can import the code into your project and make the function calls from C#. (See: DLLImport).

That is what I do with a number of interfaces I use at my job, because most of the interfaces were written in C++, not C#.
User is offlineProfile CardPM
+Quote Post

Nayana
RE: SerialPort
19 Feb, 2008 - 04:24 PM
Post #5

DIC Hawk - 나야나 नयन:
Group Icon

Joined: 14 Nov, 2007
Posts: 824



Thanked: 5 times
Dream Kudos: 175
My Contributions
It won't work. Arduino is a development board, and the code you are uploading is being compiled and RUN ON THE BOARD.

C# will never run on the board. There is no CLR that will run on that chip.
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: SerialPort
21 Feb, 2008 - 10:59 PM
Post #6

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,032



Thanked: 38 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
This Serial Port Communication in C# Tutorial may be of some help.
User is offlineProfile CardPM
+Quote Post

dragonuv
RE: SerialPort
30 Mar, 2008 - 03:13 AM
Post #7

New D.I.C Head
*

Joined: 18 Feb, 2008
Posts: 3

QUOTE(Nayana @ 19 Feb, 2008 - 05:24 PM) *

It won't work. Arduino is a development board, and the code you are uploading is being compiled and RUN ON THE BOARD.

C# will never run on the board. There is no CLR that will run on that chip.


I had no intention of running c# on the board, i know it is impossible, i just want the simplest code on how to transfer this code: digitalWrite(pin,HIGH); from c++/c to c#. I still didnt get how to use this using the serialPort control, i need something that teaches how to use the serialPort with Arduino, not serialPort alone.
I hope u know what i meant.
Thanks.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 01:53PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month