Want output of exe file to pipe to COM 16 where Arduino is. So made a simple char out file below:
This above file gets piped into a serial out file that reads the keyboard (normally std in) and outputs char it gets.
I used the command below:
S8erialHaptic.exe waits for std in and sends chars it gets out COM 16.
Here's the file that does the receiving from a1scout and the sending to com16.
'Now going to get input from keybd that outputs on serial . Worked.
'Worked, in that it sent A and got back a char from arduino A0SCREAD. Now going to cut out all the 'commented rubbish.
Dim As Integer ms 'millisecs
ms = 200
Dim As String sadresult
open com "com16:9600,n,8,1,cs0,cd0,ds0,rs" as #1
if err <> 0 then
print "Error opening COM16:"
sleep
end
end if
sadresult = Input$ (1,#1) 'clear out crap in in buff
do
print ">";
'print #1, "A";
sadresult = Input$ (1)
print #1, sadresult;
'print "a";
print sadresult 'display result
'sleep ms,0 'reading evering 3 seconds
'print "B";
'sleep ms,0 'reading evering 2 seconds
'print"C";
'sleep ms,0 'reading evering 2 seconds
nn
Sunday, August 16, 2015
Saturday, July 25, 2015
Use mode in batch file to fix serial paramters
Here's my batch file:
----------------------------------------------
rem set serial port to 9600,8,n,1
mode com16 baud=9600 parity=n data=8
-------------------------------------------------
hh
Friday, July 24, 2015
This site is good for redirecting to COM ports
This helped me a lot.
In above, I wrote a little exe file in FreeBasic to output a character every 5 seconds. The Arduino was on COM16 via USB-Serial. Somehow the baudrate etc was all ok.
Here's the FreeBasic program: (note most of it is commented out)
---------------------------------------------------------------------------------------
' this time redirect output via dos command
'this part just print chars to standard output
dim adresult as single
' open com "com16:9600,n,8,1,cs0,cd0,ds0,rs" as #1
if err <> 0 then
print "Error opening COM16:"
sleep
end
end if
do
print 59;
print #1,59;
' rem input #1, adresult 'get result
' print adresult 'display result
' sleep 3
sleep 5000,0 'reading evering 2 seconds
loop until inkey$ = chr$(27)
sleep
----------------------------------------------------------------------------------
c
In above, I wrote a little exe file in FreeBasic to output a character every 5 seconds. The Arduino was on COM16 via USB-Serial. Somehow the baudrate etc was all ok.
Here's the FreeBasic program: (note most of it is commented out)
---------------------------------------------------------------------------------------
' this time redirect output via dos command
'this part just print chars to standard output
dim adresult as single
' open com "com16:9600,n,8,1,cs0,cd0,ds0,rs" as #1
if err <> 0 then
print "Error opening COM16:"
sleep
end
end if
do
print 59;
print #1,59;
' rem input #1, adresult 'get result
' print adresult 'display result
' sleep 3
sleep 5000,0 'reading evering 2 seconds
loop until inkey$ = chr$(27)
sleep
----------------------------------------------------------------------------------
c
Subscribe to:
Posts (Atom)