Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpIntegration › language support

Page Index Toggle Pages: 1
language support (Read 15310 times)
06/05/07 at 21:01:26

alikhan   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 4
*
 
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
 
IP Logged
 
Reply #1 - 06/05/07 at 21:59:20

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
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?
 
IP Logged
 
Reply #2 - 06/05/07 at 22:59:24

alikhan   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 4
*
 
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
 
IP Logged
 
Reply #3 - 06/05/07 at 23:53:05

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
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/
 
IP Logged
 
Reply #4 - 06/06/07 at 07:54:43

alikhan   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 4
*
 
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
 
IP Logged
 
Reply #5 - 06/06/07 at 23:23:02

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
There are many libs in the net, here is one afriend has used: http://sourceforge.net/projects/libserial/ let me know.
 
IP Logged
 
Reply #6 - 07/06/07 at 15:16:22

janes   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 7
*
 
Ali,

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

 
IP Logged
 
Reply #7 - 07/06/07 at 17:34:53

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
janes, could you post them? we can link them to your site, that would be great.
 
IP Logged
 
Reply #8 - 07/10/07 at 19:34:04

janes   Offline
YaBB Newbies
I Love YaBB 2!

Posts: 7
*
 
I can post it, I will first need to clean it up a little.
 
IP Logged
 
Reply #9 - 10/30/07 at 01:15:05

fraser   Offline
YaBB Newbies
Yea right...
Manchester, UK

Posts: 3
*
 
Hello,

my first post so please be gentle  Embarrassed

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.

 

Regards,&&&&Fraser.
IP Logged
 
Reply #10 - 10/30/07 at 03:38:26

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
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.
 
IP Logged
 
Reply #11 - 10/30/07 at 10:09:12

fraser   Offline
YaBB Newbies
Yea right...
Manchester, UK

Posts: 3
*
 
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
« Last Edit: 10/30/07 at 15:02:56 by fraser »  

Regards,&&&&Fraser.
IP Logged
 
Reply #12 - 11/07/07 at 11:53:26

fraser   Offline
YaBB Newbies
Yea right...
Manchester, UK

Posts: 3
*
 
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.
 

Regards,&&&&Fraser.
IP Logged
 
Reply #13 - 11/07/07 at 20:38:56

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
Great! I will link them from the tutorials as well. Thanks for the good work and contribution Smiley
 
IP Logged
 
Page Index Toggle Pages: 1