Go Down

Topic: Serial data to Visual Basic, Visual C++, Java (Read 8 times) previous topic - next topic

tigrezno

May be any of you can help me.

Sometimes, when speaking to arduino from linux, i just read crap from arduino, and after some refreshes, i read good values.
Both are configured at 9600, no parity, 8bits, 1 stop bit.

Do you know why is it happening?

wicher

Hi Mikmo!
can you put the link? I´m trying to develop some interface betwen Arduino and a VB6 app. I was wondering to write a protocol using the interrupt signals an serial event for read an write de analogs an digital pins from a VB6 environment.
I´ll be pleased to send the results, but at this moment is only a paper. I´m a newbie in C programming.

bHogan

Sorry to resurrect a (relatively) old thread, but I  found something that may be helpful to those who want to use VBScript to communicate to the Arduino. It's a free OCX available at:
http://home.comcast.net/~hardandsoftware/NETCommOCX.htm

Quote
The NETCommOCX is an ActiveX control that wraps the functionality of MSComm32.ocx.


Using this, it was easy for me to write a script that sends the date and time to my sketch with no special programming environment installed.

John
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll

MikMo

Sorry !

I just realized that i goofed up and forgot to actually post the promised link.

Here it is.

http://mikmo.dk/misc/vbarduino.zip

I'm currently working on a much more advanced project involving Arduino and VB.net. When i get a little further more source code will be made available.


florinc

#19
Feb 01, 2009, 04:56 pm Last Edit: Feb 02, 2009, 02:15 am by florinc Reason: 1
Hi,
This may have been posted before, but "repetition is the mother of learning".
It is possible to send data on serial port in windows just by using the windows-installed components. A simple vb script that reads a text file and sends it to serial port is shown below:

Code: [Select]
Const ForReading = 1
Const ForWriting = 2

'-------------------------------
' open USB serial port (COMx);
'
' If the serial monitor in Arduino IDE is open, you will get an "access denied" error.
' Just make sure that the serial monitor is closed (so bytes are not sent by the arduino board).
'-------------------------------
Set fso = CreateObject("Scripting.FileSystemObject")
Set com = fso.OpenTextFile("COM4:9600,N,8,1", ForWriting)

'---------------------------------------------
' read content of text file line by line;
' write line to COMx;
'---------------------------------------------

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\docs\quotes.txt", ForReading)

MsgBox("Ready to write file content to COM")

  Do While objFile.AtEndOfStream <> True
     '--------------------------------------------------
     ' read a few (10) characters at a time; serial buffer is limited to 32 characters;
     ' writing a character to eeprom takes about 11 ms (assuming that there is no serial.prints in the loop);
     ' therefore, after each batch of 10 chars sent to COM, we should wait no less than 110 ms;
     ' we use 200 to have a margin of safety;
     '--------------------------------------------------

     strChars = objFile.Read(10)
     com.Write(strChars)
     WScript.Sleep(200)
  Loop


objFile.Close
com.Close()

MsgBox("Finished writing to COM")



I used this script to load an 25LC256 eprom with quotes from a text file, part of my implementation of the "Life clock" project initiated by Mr. BroHogan (see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1214682544).
According to the datasheet, the eprom requires a 5 ms delay after each byte written (it takes its time to carve the data onto the silicon). In my writeByte function, I used a delay of 10 ms.

A 32K text file takes about 10 minutes to write to the eprom using this script.

Go Up