Some help with Serial connection

andTo86:
You should be able to piece together some sample code to write the serial directly to a .csv. You can open them with excel, but you have to open excel first, then open the file from within excel, and it will launch a wizard to import your data.

If you go see the templogger page here:-Standalone Temperature/Voltage Logger updated to v1.1 « insideGadgets
you will see that somehow whatever application you have open -spreadsheet , text write ,notepad etc when the button is pressed on the device which is plugged into the USB then data flows into the application?

He used to use V-USB which I assume is a small program library included with his arduino code.Now he uses a "SATVLTransfer code which does the same thing. I do not understand how it gets into the applications automatically?
Yes I do not use Windows or any silly VB code

Are you EVER going to read the posts before your cynical responses?

I don't know what you are talking about, but I won't be responding to you anymore.

PaulS:

Are you EVER going to read the posts before your cynical responses?

I don't know what you are talking about, but I won't be responding to you anymore.

Jeez I hope not

This is the Python approach . A Server is started which serves the data received to a web page updating each second. See pic attached if I can get it there http://NMEAScreens.jpg - 108 KB

That rapidshare is a pain
Here is a link to his site
http://www.holdentechnology.com/component/content/article/69-wifi-nmea-server-with-nook-display

Quote from: PaulS on 13-09-2012, 12:58:10
Quote
Are you EVER going to read the posts before your cynical responses?
I don't know what you are talking about, but I won't be responding to you anymore.
Jeez I hope not

Ladies, please - keep it civil.

Look no swear words -you dont get more civil than that!

Now he uses a "SATVLTransfer code which does the same thing. I do not understand how it gets into the applications automatically?
Yes I do not use Windows or any silly VB code
[/quote]

Still not quite sure what you're asking, so pardon me if this is obvious - the serial characters come across the usb connection, and the satvltransfer.exe apparently receives them and saves them to a file. Is that the part you're asking about - save them to a file? I would assume they are just taking the data in whatever format it's coming over in, separating out the different variables, and formatting the data into a .csv format, and saving it to a file on your computer. If you're not familiar, .csv stands for comma separated values. You just write a text file that contains all of your data, separated by commas, with a newline character between rows. Rename it to .csv, and you can open it with open office or excel.

Example of the formatting...

139756,546.53,0.00,425,5,302,7,426,7,
139756,546.51,0.00,430,5,308,7,438,7,
139752,546.53,0.00,424,5,303,7,405,7,
139760,546.53,0.00,440,5,310,7,427,7,
119788,546.51,0.00,437,5,311,7,429,6,
139752,546.51,0.00,427,5,305,7,439,7,
139764,546.53,0.00,426,5,310,7,406,7,
139752,546.53,0.00,433,5,310,7,432,7,
139756,546.53,0.00,430,5,303,7,422,7,

Thanks
I understand all of the .cvs and file stuff OK . What I don't follow is he says "whatever application you have open when the device is plugged in and the send button pressed the data will transfer into it"

That .exe program obviously does that but I have asked him how and he has not revealed how.
The V-USB program was used in the previous SATVL project before this SATVLtransfer.exe and it did the same thing but this is what I am unable to pinpoint how at this stage.

So I'm thinking that there might be something obvious I am missing when it comes to putting data straight into applications -can you help at all?

Just skimmed through the announcement found here:

http://www.insidegadgets.com/2012/08/13/standalone-temperaturevoltage-logger-updated-to-v1-1/

which says, in the last lines:

It will generate a file name based on the current date and time and show you the data being transferred.

So I don't see the logger program injecting data directly into any app, just writing data into a file (like the csv approach others have told you about).

Maybe with Visual Basic one could write a serial-to-excel program that uses excel api to open a spreadsheet and control it (just guessing). Maybe Openoffice has some similar capability too (don't know OOo Basic that well, either).

Thanks - That's now using SATVLtransfer.exe which is what he uses now and unfortunately won't disclose any more about it except he got the idea from a friend. It writes to a file and I do not have that device.

I have the version before that on my device which writes direct to any application that is open when the device is plugged in. It uses a program called V-USB to do the transfer, which I have ,but the bit I am asking for detail of is the fact that it puts data into whatever application is open. I don't understand how it does that? I should state it is all in the programming on the attiny45 chip that is supplied with the device

Ah, I see. Well, what can I say ? I'm interested too :stuck_out_tongue:

In this instance, it looks like V-USB is being used to emulate a USB keyboard. If this is your goal, a Leonardo makes this functionality quite simple, as it has keyboard and mouse emulation libraries supplied in the IDE.

...so it would inject the data in whatever app has focus at the moment, right ? If that's the case, the there's a chance that having the "wrong" app in focus while the data comes in would make "strange" things happen...

That would seem likely.

And does in fact happen if you have say an image maker open

april:
And does in fact happen if you have say an image maker open

hmmm.... scary! :stuck_out_tongue:

Ahh.. Ok. Yes I've done this in the past - again in VB on windows. I had to find the process ID of the window I was looking for and use a windows API function to activate that window, then the vb.net sendkeys() function to send individual keystrokes to the app. Not sure if you can apply the same thing on linux or not, but here's what I did:

Private Function FindApp() As Int32
' Loop through process table, return process id of process named 'Notepad.exe'
Dim proptr() As Process
Dim Pid As Process
proptr = Process.GetProcesses() ' Get an array filled with all process IDs
For Each Pid In proptr
Try
If Pid.MainModule.ModuleName = "Notepad.EXE" Then
Return Pid.Id ' Notepad found, return process ID
End If
Catch ex As System.ComponentModel.Win32Exception
Catch ex As InvalidOperationException
End Try
Next
End Function

Private Function ActivateApp() As Boolean
' Gives Notepad focus to receive HID keys
Dim AppID as integer = FindAPP()

If AppID <> 0 Then ' We found our application!
AppActivate(AppID)
Return True
Else : Return False ' Not running??
End If
End Function

To use:
ActivateApp()
SendKeys.SendWait("Keys to appear in notepad...")

This might be interesting (just saw it mentioned in another thread somewhere):

http://www.parallax.com/tabid/393/Default.aspx

Not exactly what you're looking for, but on Linux a way to capture data coming in from the serial port is this:

minicom -D /dev/ttyUSB1 -b 115200 -o -C dump.txt

where /dev/ttyUSB1 must be changed to the actual device (e.g. ttuUSB0, etc.), and 115200 must be equal to the value given in Serial.begin() on the Arduino.