
Sarian Basic Interpreter
========================

Example files
-------------

This folder contains various general Basic examples.

The scripts may be transferred onto a Sarian using an
FTP client program.

To run a basic script use the command:

	bas <filename>

Where <filename> is a file containing the basic script.

To stop a basic script running, use the command:

	basic 0 kill

The example scripts are described below:

argpass.bas -   this demonstrates the 'pass by reference' (default) and the
                'pass by value' methods of parameter passing.

assoc.bas -     illustrates associative arrays

asyio.bas -     illustrates non-blocking serial input and output. This script
                waits 10 secs for a line and times out if nothing received or
                you type 'bye'.

cmdline.bas -   illustrates using the command line

div0.bas -      illustrates catching a divide by zero exception

event.bas -     shows how to generate a user event in the eventlog, which
                can be used to generate an event email, trap or sms.

execute.bas -   an example of the "execute" function, which runs a Sarian command
                and returns any response from the command

gprslog.bas  -  This example maintains a log file of the GPRS signal strength

gprsmib.bas  -  This example reads the GPRS MIB variables and reports the signal
                strength and registration status.

gps.sb       -  an example which reads GPS data from a serial port and decodes it

hostname.bas -  an example of the "hostname" function

listener.sb -   an example of a socket listener. This relays data from a serial port
                when a socket is connected

mibset.bas   -  an example of how to write variables to the Sarian's internal MIB

mibtest.bas -   an example of how to read variables from the Sarian's internal MIB

midonio.bas -   a simple script which polls a Midon Tempo8 device and sends the
                sensor readings to a TCP socket

mybascfg.asp -  an example Basic web configuration page, showing the use of the
                "basiccfg" form for configuration and starting/stopping basic scripts.

newfile.bas -   an example of how to write a RAM file and then save it to flash

onerror.bas -   demonstrates error handling using "on error"

pop3.bas -      demonstrates socket i/o by accessing a remote pop3 server and
                listing the mailbox contents. To run this example, use the command
                bas pop3.bas <server> <username> <password>
                Note that the sarian must be correctly configured to route to the
                pop3 server.

rdfile.bas -    reads lines of text from a file called "rdfile.txt" and prints to the
                command output.

rdlines.bas -   reads lines input from ASY0 and prints them on the command interface.

rwasy.bas -     reads and writes lines to/from asy0

sendmail.bas -  this example constructs an email template and sends it using the
                email command.

sieve.bas -     a prime number generator (takes about 15 secs)


skt4.bas -      demonstrates socket i/o

sleep.bas -     demonstrates the sleep function

sms.sb -        shows how to receive SMS messages

time.bas -      shows the various time functions


1-WIre Library
--------------

The Basic 1-Wire support library is in the folder called 1wire. This contains two
sub-folders as follows:

lib - the 1-Wire library
examples - example scripts which use the 1-Wire library

See the readme files in these folders for a description of the files.
