- a Basic Interpreter for the Sweex/Edimax router and Debian Slug
Home site http://www.blassic.org/
The Manual in .doc format.......The same converted to a web page
I like basic - you can understand a line of code just by reading it!
And strings in basic are much easier to handle than in C!!!
I can edit Blassic basic using BBedit on a Mac and read and save to the router by the BBedit built in ftp commands.
No waiting to compile a C program - and Blassic runs plenty fast enough for control applications.
I thank Picprojects for introducing me to Blassic.
It runs on Linux and he has compiled a version for the Sweex/Edimax routers.
See his tutorial The following notes are based on his email answers to my questions.
These are my notes to aid my memory - if you use them to do interesting things please email me!
ready to install Blassic
Add picinternetprojects to the list of locations ipkg can install files - more info here
update /etc/ipkg.conf by adding -
src picprojects http://www.picinternetprojects.247n.com/packages
src picprojectsSDK http://www.picinternetprojects.247n.com/packages/sdk
test it -(to exit
and return to the command prompt type 'exit')
load and save
use load "filename.bas" and save "filename.bas" as in the example above
Write your program in a text editor and save it as "program.bas"
In a script you can write "blassic program.bas" and the program will run.
Make the last line of your program something like '999 system' so that
the program will exit.
Whilst debugging, If you use -
- then the file will be saved in ascii text and you can still use your editor to edit it
|Official Blassic reference also see the Yahoo Blassic group|
Send strings to a Blassic program from a web page and display the output of the program on the web page
that sends out 3 strings from a form back to b_test.cgi which calls
Blassic code notes - some random notes
Have the program run using the command line format
place this on the first line of the Blassic program (NB there is no space after the # as the Blassic manual shows)
Blassic as a cgi scripting language (how easy can this get ?!!!)
Sending data to a website as though from a Web Browser
However, I find that I can use htget.bas . This is designed to fetch a remote page but I find it also allows you to send any string to a server.
The link on my web page is
My move_snap.cgi script sends the string to a script pg-picture_control.sh
In there I included this line to make the picture small -
Send "Hello" to the rs232 port
This also sends a string to the rs232 port
This sends the decimal value of a character to the rs232 port
outputs 65 to Hyperterminal
send a single byte (input as decimal) to ttyS0
Send a string containing several words and spaces to the LCD panel
shell "/usr/bin/lcd_out_4x20 -i"
shell "/usr/bin/lcd_out_4x20 "+CHR$(34)+fred$+CHR$(34)
NB! CHR$(34) is "
Also - to place a space between two strings on the bottom line,
SHELL "lcd_out_4x20 -4"
Put the contents of file /var/www/ramdisk/myfile into string mystring$
Extract a string 3 bytes long starting at byte 2
mystring$ = MID$ (original_string$,2,3)
Create a shell command that contains a Blassic string mystring$ within the command sent
Send a non printing byte to the ttyS1 port
-n means do not add CR/LF
use hex, \x13, or octal, \ 023 to represent decimal 19 and send itout on ttyS1
shell "echo -n -e '\x13'>/dev/ttyS1"
Catch the input from ttyS1
Wait for the input to be over
# stop listening to ttyS1
- do something with the saved data
Send a byte from a Blassic program to an ash script (via the ramdisk)
Run a c code program from within Blassic and use the output of the c program within Blassic
To send a string from a bash script to a Blassic program then display it on the LCD panel
I use "export" to create an environmental variable that is available to any program
The ash script is -
export message="this is a message"
the Blassic program includes -
(I can only get this to work if the Blassic program is called from the script after the export
Read a byte from an RS232 port
You first need to get ttyS0 into raw mode - I run /usr/bin/rs232io_ttyS0_96 on the stick - then it acts like ttyS1 which works one character at a time in each direction. See the rs232 notes. I plan to study/test this but I know stty is odd in this router
' serial in tests serial_in.bas
It works with Hyperterminal connected to ttyS0 - I have yet to test it with small ascii values - hex00 is very odd in ash scripts.
Some of my backup programs - they run but are not often efficient!
- saved here to copy and paste routines from.
|That's all I have
tried for now -
If you write a Blassic program for the Sweex please send me a copy by email