|
Post by BillSturm on Mar 24, 2008 13:00:22 GMT -5
Copied from the USB thread... Should I put this into a while loop and loop until the file exists? (or some other break condition) Will the program still respond to links or will it be too busy? I don't see any sleep command or timer to minimize processor utilization. Bill Run BASIC doesn't allow you to run in the background. If you can see the web page (and you alway can), then your program is waiting for input. It seems compelling to be able to run a second Run BASIC program in the background and communicate with it for certain kinds of applications. -Carl I would like to be able to create either periodic events or respond to events from an external program. What I am trying to do is update the display automatically when some external data changes. If this were possible, would it cause collisions with user generated events? I was planning to read serial data in LB and pass it to RB via a file. I guess I will need an "update" link to check for data. That is not what I was hoping for, but it may work fine. I understand that that is how most Web pages operate. What is the proper way to create "live feeds" in a web page?
|
|
|
Post by carlgundel on Mar 24, 2008 15:27:29 GMT -5
Copied from the USB thread... Run BASIC doesn't allow you to run in the background. If you can see the web page (and you alway can), then your program is waiting for input. It seems compelling to be able to run a second Run BASIC program in the background and communicate with it for certain kinds of applications. -Carl I would like to be able to create either periodic events or respond to events from an external program. What I am trying to do is update the display automatically when some external data changes. If this were possible, would it cause collisions with user generated events? there are some examples posted here that talk about using Javascript to periodically trigger calls to the RB server. Perhaps the v1.0.1 release should include such an example. -Carl
|
|
|
Post by zoomkat on Mar 24, 2008 19:05:44 GMT -5
You might try generating a page containing a seperate meta refreshing frame inside the page that gets the data.
|
|
|
Post by kokenge on Mar 27, 2008 17:30:21 GMT -5
Currently I have a airplane avionics system I'm developing. I'm letting it sit until RunBasic has Serial Port functions. But it does pulse the instruments once every second from a backend program that will eventually open a Serial Port. Until then it simply uses the milliseconds since midnight to simulate the numbers returned from the Serial Port. It then sends information about the instruments to the front end and displays graphs and other informaton.
Granted the interface only pulses every second and is very slow, but it will work for airplane instruments that don't change much.
Here is the code I use to fire the backend process. It has been tested and works. The actual program is a little complex, however this routine should give you some ideas.
When running the RB program, the button changes from [Start] to [Stop] It's a very simple routine, so hope this helps. If you have more questions, let me know.
' --------------------------------------- ' Timer routine ' --------------------------------------- html " <script type='text/javascript'> <!-- var IntervalId = 0; function ClickHandler ( ) { if ( document.getElementById('btn').value == 'Start' ) { // Start the timer document.getElementById('btn').value = 'Stop'; IntervalId = setInterval ( 'timer()', 1000 ); } else { document.getElementById('time').innerHTML = ''; document.getElementById('btn').value = 'Start'; clearInterval ( IntervalId ); } } function timer( ) { server('/seaside/go/runbasicpersonal?app=avionicsBe&time&|ts|&|pass|') }
html "<input type='button' name='btn' id='btn' value='Start' onclick='ClickHandler()'/>"
Have a great day...
|
|
|
Post by BillSturm on Mar 27, 2008 22:13:49 GMT -5
So you use a JS applet to call the RB server? Interesting... I'll try it, but for now I'm rethinking my app to just display the data as it was when the page is loaded. I'll probably put a Refresh button just in case.
I could use a serial port too, hopefully one is added someday. If the serial port raises events when a character is received, it may solve my update issues also. A periodic timer event sure would be handy also, to issue serial commands.
|
|
|
Post by kokenge on Mar 28, 2008 6:26:47 GMT -5
The reason for the JS calling the backend is because the front end displays graphs and information from the backend (serial port someday) I have it written in Liberty basic and use the chameleon A to D converter ($39 eBay) so I know the interface works fine.
However I want it in RunBasic so I can be on the web. Since it will be a server, you can watch the airplane as it flies from anywhere with web access. I already tested this.
I have JS code that allows you to put data to any ID field on the front end. Simply use a raw command on the backend and name the fields with their data.
I use 2 RB programs - 1. avionics.bas - this displays graphs/informaton and fires the backend every second (or whatever you set) 2. avionicsBE.bas . The backend. It sends data to ID fields in the avionics.bas program.
If you want a copy of the programs, let me know. Might give you some ideas.
Have a great day..
|
|
|
Post by BillSturm on Mar 30, 2008 11:17:41 GMT -5
If you want a copy of the programs, let me know. Might give you some ideas. Thanks, that might be very helpful. I sent you a private message with some contact info.
|
|