Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Programming Questions & Help >> Integration >> language support
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1181077287

Message started by alikhan on 06/05/07 at 21:01:26

Title: language support
Post by alikhan on 06/05/07 at 21:01:26
Hi
Is it possible to integrate this languagge with java / c#? or is it possible to create some kind of "dll", so that I could call that "dll" from my c# code.
Please let me know, if you have any idea.
Your help in this matter will be really appreciated.

Ali

Title: Re: language support
Post by barragan on 06/05/07 at 21:59:20
yes it is possible, there is code available written in Java, C#, C++, and C to read/write data from/to a serial port. The wiring board is seen by the computer as an additional serial port, so data can be transfered from/to the board as it is done through any serial connection. Do you have a particulat language need?

Title: Re: language support
Post by alikhan on 06/05/07 at 22:59:24
Hi
Thanks a lot for your help, actually I want to implement my work either in c# or java, could you please send me that samples of code which are available in java and c#?
Thanks in advance!
Ali

Title: Re: language support
Post by barragan on 06/05/07 at 23:53:05
hi, yes, the Wiring development environment is written in Java and here is the source code for Serial.java file which has the code to open read/write from.to the serial port. http://wiring.org.co/source/trunk/wiring/app/

Title: Re: language support
Post by alikhan on 06/06/07 at 07:54:43
Hi
Really thanks a lot for this link, but I could not find any sample for c#. I think even it will be fine, if I found sample code for c++ . Because then I will make "dll" and use this dll in c#.
Do you have any samples for c#?
Thanks!

Ali

Title: Re: language support
Post by barragan on 06/06/07 at 23:23:02
There are many libs in the net, here is one afriend has used: http://sourceforge.net/projects/libserial/ let me know.

Title: Re: language support
Post by janes on 07/06/07 at 15:16:22
Ali,

Are you trying to communicate to the wiring board in c#? If so I have some small samples.


Title: Re: language support
Post by barragan on 07/06/07 at 17:34:53
janes, could you post them? we can link them to your site, that would be great.

Title: Re: language support
Post by janes on 07/10/07 at 19:34:04
I can post it, I will first need to clean it up a little.

Title: Re: language support
Post by fraser on 10/30/07 at 01:15:05
Hello,

my first post so please be gentle  :-[

I got my Wiring board last week and have so far used ActionScript, PHP, C++, c# and Processing to communicate with Wiring.

For c# I have been using the free Visual C# Express Edition http://msdn2.microsoft.com/en-gb/express/aa700756.aspx and also Visual Studio 2005. Here is a quick console app I put together that uses the System.IO.Ports namespace to communicate with Wiring. You should be able to get a good idea of the basics from this.

Highlighted c#/Wiring code: http://www.msa.mmu.ac.uk/~fraser/wiring/wiringChat.html
c# source code: http://www.msa.mmu.ac.uk/~fraser/wiring/wiringChat.cs
Wiring code http://www.msa.mmu.ac.uk/~fraser/wiring/wiringChat.pde

The applicaiton uses System.Threading to read data from wiring on a separate thread to the main console. It also uses the System.Management namespace and a WMI query to get a more detailed information about the COM ports than System.IO.Ports provides (...go figure). I wanted this info because I'm developing a Windows application that automatically connects to Wiring when it is available.

I have some more complex Multi-threaded Form based Applications in c# that I have been working on as well. I'll post links when I upload them. I'm also in the process of setting up a little site for my experiments, again, I'll post a link to it when it's up.

Anyway, any feed back is more than welcome.


Title: Re: language support
Post by barragan on 10/30/07 at 03:38:26
hey this is very cool, it is great you are sharing this, I see in the wiring code you are using a buffer, internally the serial has a buffer. You can checn the source code here:
http://wiring.uniandes.edu.co/source/trunk/wiring/lib/Serial/ inside the utility are the basic functions.

Title: Re: language support
Post by fraser on 10/30/07 at 10:09:12
Hi,

Thanks barragan.

No worries about sharing the code, it's a pleasure to be able to contribute to the community. I had a look through the serial lib. buffer.c is beautiful! There I was just making hard for myself...

I see I could reduce the Wiring code for this example to something like.  (...off the top of my head here, not tested!)


Code:
// Serial Input
void setup()
{
 Serial.begin(9600);
}
void loop() {
 if(Serial.available()) {    
   while (Serial.available()){            
     Serial.print(Serial.read());
   }
   Serial.println();
 }
 delay(1000); // wait 1 second  
}


Thanks for pointing that out!

p.s.
I cleaned up and modified the code highlighting for the wiringChat example:
http://www.msa.mmu.ac.uk/~fraser/wiring/wiringChat.html

Also, I have created a simplified version without the additional namespaces. This should be easier for people to follow
http://www.msa.mmu.ac.uk/~fraser/wiring/wiringSimpleChat.html

Title: Re: language support
Post by fraser on 11/07/07 at 11:53:26
Hi,

FYI, I have put the c# examples at http://www.msa.ac.uk/~fraser/wiringpg/ I will be adding some other languages to the site soon!

F.

Title: Re: language support
Post by barragan on 11/07/07 at 20:38:56
Great! I will link them from the tutorials as well. Thanks for the good work and contribution :)

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.