Post by mackrackit on Jan 12, 2008 22:53:36 GMT -5
A very simple demo to work around Rb not having com port capabilities. (at
least I do not think it does)
This page shows a camera in my shop with a LED in front of it. You can turn the LED on or off with RB and LB.
Click the "Remote Test" button.
www.mackrackit.com/mac/www/run_basic/run_basic.html
The machine running RB and the LB program has Ubuntu 7.10 for an OS.
Because of band width, the video is a little on the slow side but you should
be able to see in real time the LED.
Here is the RB code:
And the LB code:
And Lb needs a text file:
"savecom.txt:"
COM1:9600,n,8,1,ds0,cs0,rs
This is where you set up the com port.
least I do not think it does)
This page shows a camera in my shop with a LED in front of it. You can turn the LED on or off with RB and LB.
Click the "Remote Test" button.
www.mackrackit.com/mac/www/run_basic/run_basic.html
The machine running RB and the LB program has Ubuntu 7.10 for an OS.
Because of band width, the video is a little on the slow side but you should
be able to see in real time the LED.
Here is the RB code:
[display]
cls
link #write, "LED ON", [ON]
print" "
link #write, "LED OFF", [OFF]
wait
[ON]
open "C:\RB\port\port.txt" for output as #f
print #f, 91
close #f
goto [display]
[OFF]
open "C:\RB\port\port.txt" for output as #f
print #f, 93
close #f
goto [display]
And the LB code:
[setup.main.Window]
'-----Begin code for #main
nomainwin
WindowWidth = 300
WindowHeight = 150
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
'-----Begin GUI objects code
textbox #main.comsel, 25, 32, 180, 25
textbox #main.textbox1, 25, 62, 50, 25
'-----End GUI objects code
open "untitled" for window as #main
print #main, "font ms_sans_serif 10"
print #main, "trapclose [quit.main]"
[main.inputLoop]
open "savecom.txt" for input as #SC
CN$ = input$(#SC, lof(#SC))
print #main.comsel, CN$
close #SC
COMM$ = CN$
oncomerror [handleIt]
open COMM$ for random as #com
[RUN]
open "port.txt" for input as #f
LINE INPUT #f, txt$
print #main.textbox1,txt$
print #com,txt$
close #f
calldll #kernel32,"Sleep",500 as ulong,r as void
scan
goto [RUN]
wait
[quit.main] 'End the program
close #main
close #com
end
[handleIt]
oncomerror
notice "Error: Com Port. "; ComError$
notice "Com Port number: "; ComPortNumber
notice "Please select another Com Port in the savecom.txt file"
close #main
And Lb needs a text file:
"savecom.txt:"
COM1:9600,n,8,1,ds0,cs0,rs
This is where you set up the com port.