RobotSee Reference Manual version 6.2

By Eric Gregori ( www.EMGRobotics.com )

Copyright 2009

Introduction

    RobotSee is a programming language designed to be as simple as BASIC with the power of C.  If you remember programming a Commodore 64, AppleII, or any other computer from the 1980’s then you have programmed in BASIC.  BASIC or Beginners All-purpose Symbolic Input Code is a simple language used for years as a entry point into programming.  BASIC has been replaced by more advanced but harder to learn languages like C, C++, and JAVA.  The purpose of RobotSee is to bridge a gap between a simple entry language like BASIC, and a more powerful harder to learn language like C.  RobotSee was designed for the programmer and non-programmer alike, providing a stepping stone to more advanced languages.

    Advanced programmers will notice that RobotSee uses contexts similar to C ( including a switch – case ). This allows the advanced programmers to write code using similar techniques as C ( for example using switch – case for state machines ).  At the same time, beginning programmers will notice that RobotSee provides intuitive and powerful keywords allowing even a simple program to do advanced function ( like ComputerVision and Speech Recognition ).  RobotSee is also a expandable language. 

You will learn in following chapters, that both the functionality and keywords of RobotSee can be expanded via DLL’s.  These DLL’s add things like ComputerVision support, Speech Recognition support, joystick support, internet support, and even graphics support to the language.  Like the base language, using these advanced features is made easy by the powerful keywords that are added to the language when the DLL is loaded.  Don’t let the term DLL scare you.  All it is, is a file that is loaded using a simple loaddll() keyword.  Everything else is done automatically.

 

 

 

 

The RobotSee interpreter is released under the GNU GPL ( revision 3 ).  You can find the license.txt file in the RobotVisionToolkit directory.  For more information goto www.EMGRobotics.com.

RobotVisionToolkit

    RobotSee is the language used by the RobotVisionToolkit. The RobotVisionToolkit was originally designed to provide non-programmers a easy method of adding computer vision to their robots.  The toolkit has expanded far beyond it’s original purpose, supporting a lot more then just computer vision, and being used for a lot more then just robotics.

 

 


 

Installation and Support

    The RobotVisionToolkit with RobotSee can be downloaded for free here: http://www.robotsee.com/downloads.html

 

There is also a RobotSee user’s group with examples, bug reports, and preliminary releases.  The discussion groups are good place to go and ask questions about RobotSee, or the RobotVisionsToolkit.

 

http://groups.google.com/group/robotsee-users

 

 

Click this to install

 
    After downloading the compressed file, simply save it in a directory, then open it.  Inside you will find a setup.exe, double click the setup.exe to start the installation process.  During installation you may be asked to install the .net framework.  The RobotSee GUI is written in c++ .net and requires the .net framework to run.  If you are not using the GUI, then the .net framework is not required.  You will find the .net framework install file in the same zip file containing the setup.exe.  The GUI uses the .net framework version 2.0, but any newer version ( 3.0, 3.5, … ) will work.

 


Double click the zip file downloaded from www.emgrobotics.com to start installation

 

.net 2.0 if required

 
 ->

 

 

 

After Installation

    After installing the RobotVisionToolkit, a emgrobotics directory will be created on the drive you specified during installation ( C: by default ).  In addition you will have a EMGRobotics entry in your Start->Programs folder.

rvt_start.bmp

 

EMGRobotics directory ( C:\EMGRobotics    by default )

rvt_dirs.bmp

 

Executing a RobotSee program

    RobotSee programs are executed using the RobotSee interpreter.  Programs can be executed from the command line ( allowing for execution from a autoexec or batch file at power-up ) or using the GUI.  In the EMGRobotics directory, there is a batch file called ClickHereToBegin.bat.  To run the program, simply double click on the .bat file.

 

To run your first sample program: ClickHereToBegin.bat

Goto Start -> Programs -> EMGRobotics -> RobotVisionToolkit

Click on “Shortcut to ClickHereToBegin.bat”

Be sure the volume is turned-up on your computer, this demo talks to you.  You will see a console window open, along with a text window.  The text window contains the actual code that is being run.  The console windows shows the program as it is running.  This demo is a little tutorial on RobotSee.

     Console window             text window containing code

rvt_demo1.bmp

Running Additional Examples

    In addition to the example shown above, there are many other examples in the Examples directory. To get to the Examples directory:

Goto My Computer -> click on the drive where you installed the RobotVisionToolkit ( C:\ by default ) -> EMGRobotics -> RobotVisionToolkit -> Examples

 

In the Examples folder you will find various .bat files to click on.  Each .bat file will automatically open and run a corresponding .see program.

rvt_examples.bmp

 

 

Executing a RobotSee program from a command line

    RobotSee programs are run, by passing the .see filename to the RobotSee_Console.exe application.  This is easily done using the following command line:

 

RobotSee_Console program_name.see

 

To do this under Windows, you must first open a command prompt window.

Start -> Accessories -> Command Prompt

In the command window type: cd c:\emgrobotics\robotvisiontoolkit

Then type: RobotSee_Console Examples\RobotSee_Version.see

This will execute the .see program in the Examples directory.

rvt_commandline.bmp

 

This examples displays the RobotSee interpreter version to the console window, using the version() keyword.

rvt_command2.bmp

 

Writing your first RobotSee program

    RobotSee programs ( .see ) files are written using any text editor ( Notepad, WinWord, or the RobotSee GUI ).  To write your first RobotSee program, open a window into the RobotVisionToolkit directory:

My Computer -> C: -> EMGRobotics -> RobotVisionToolkit

In the window, right click, select new, select Text Document

name your new file first.see

Then select first.see, right click, open with WordPad

In WordPad type: version()  then select File -> Save

To run your new program, open a Command window ( using instruction in previous section ) and type:

Robotsee_console first.see

rvt_new1.bmp

 

rvt_new2.bmp

rvt_new3.bmp

 

 

 

RobotSee Programming

    I have noticed through my years as a software engineer, that written explanations of software are almost always significantly longer then the software itself.  Unfortunately English is an extremely inefficient method of describing software.  As a result, this portion of the document is going appear more complicated the RobotSee programming really is. That’s just an effect of the inefficiencies of English. With that statement, I would encourage you to stop here, and look at some of the sample .see programs in the Example directory specified above, and look at some of the .see programs listed at the end of this document.  You will notice after looking at the examples, that writing RobotSee programs is actually very simple.

    RobotSee programs are made up of statements. Each statement ends with a ( /r/l or 0x0d0x0a ) carriage return ( enter key ). This allows RobotSee programs to be written using just about any text editor ( save your .see file as txt if using MSWord ). There is normally, only one statement per line. You can put multiple statements on one line, by ending each statement with a ‘;’ semicolon. 

    Statements are made-up of: variables, operators, and keywords.  Statements are executed one line at a time from the start of the file, to the end of the file.  A optional end() keyword will cause execution to stop on the line containing the end() keyword. A double forward slash //  is used to indicate the start of a comment.  The end of the comment is identified with a carriage-return/linefeed ( 0x0d0x0a ) which your text editor will add when you push the enter or return key on your keyboard.

 

 

 

 

 

A simple RobotSee program

Version()               // Display Interpreter Version info

print( “Hello World” ) // Display Hello World on console

 

Notice, our simple program just ends.  The interpreter will detect the end-of-file, and terminate gracefully.

You could also use a end() keyword.

 

Version()

print( “Hello World” )

end()

The purpose of the end() keyword may not be obvious now, but later when we discuss subroutines, it’s use will become more important.

Variables

    Variables are critical for any programming language.  In RobotSee, all variables are integers ( 4 bytes ).  This simplifies learning RobotSee significantly.  One of the most difficult concepts to understand when learning a new programming language is variable types.  RobotSee solves this issue by only having a single variable type.  Although this may appear to be a limitation,  a 4 byte int is actually a very powerful type. 

    RobotSee variables can contain any signed number from -2147483647 to +2147483647.  Floating point variables are not directly supported ( as of this version ), but can be emulated.  In addition, many keywords actually do all their calculations in true floating point, providing the final result as a int.  We will learn more about this when reviewing the math keywords.

    Variable names are limited to characters, digits, and the underscore ‘_’, but they must start with a character. Case is ignored for variable names ( variable names are automatically converted to lower-case ). Variable names can be up-to 32 characters long. The number of variables is limited only by the amount of memory available.

    Variables are created using the global() keywords. Variables can be created anywhere in your program, but the interpreter actually creates the variables in memory before your program even runs.  This system is referred to as static in other languages.  In other words, all global() and array() keywords in your program are executed in order, before the first line of code in your program is executed.  This is referred to as pre-parsing. The interpreter pre-parses your program, executing all the gloabal() and #include keywords before actually starting to execute your program.  In addition, during the prepares, the interpreter strips out the whitespace, comments, and converts everything ( except strings )  to lower-case. Because of this,  you do not need to create the variable ( using global() before using it in your program.  You just need to create the variable somewhere in your program.    

 

Arrays

A special type of variable called an array is also supported.  For those familiar with C, RobotSee arrays are very similar to C arrays. Arrays are a list of variables ( again all integers ). Each entry is a integer. The number of integers you can have in a array is limited only by the amount of memory. Arrays look a lot like variables, but include a [].  Within the [] brackets is the index into the array. This is how you select which integer in the array you want to access. Arrays are NOT created during pre-parsing, so it is important that you create the array using the array() keyword before trying to use it.  In addition, array’s can be created locally.

    Local variables are a special case of variable that acts very differently then variables created with the global() keywords.  Local variables are an advanced topic.  If you are new to programming, you may want to skip to the variable example.

z[] Fast Variables

    The z[] variable array is a pre-created variable, that has the advantage of being very fast.  Normally, the RoboSee interpreter has to look-up a variable name in a table every time it is accessed, this is a relatively slow process.  The z[] variable, or fast variable, does not need to be looked up. The interpreter accesses it directly. 

    The z[] fast variable was created with the intent that it would be used as loop counters ( in C, i, j, or k is normally used ), but it can be used for anything.

Example: 

for( z[0]=0 )

do something

next( z[0]+=1, z[0]<10 )

z[0]-z[255] are available automatically

 

Local Variables

Local variables are created at run time ( not during preparsing like global variables ), and have a limited scope. Scope is a term used in programming languages to describe the life of a variable.  Global variables ( created with the global() keyword ) have a life that starts before your program starts running, and ends when you program is done.  Global variables are available for the life of the program.  Local variables have limited life, and their lifespan is determined by their scope.  An array() or local() variable created outside of a subroutine has the same scope as a global() variable ( the life of the program ).  An array() or local() variable created within a subroutine, is erased when the subroutine executes it’s return() keyword ( the return() keyword actually pops the variables off the stack ). 

 

 

Parameter Passing

Local variables can also be created within the gosub() keyword ( as a parameter ).  This is how RobotSee supports parameter passing.  This would be equivalent to “pass by value” in C.  So, after the subroutine returns() the local variables, along with their values are erased.

 

Variable Example

global( myvariable )      // Creates a variable named myvariable

global( my_variable )

global( my_variable2 )

 

myvariable = 100          // Assigns 100 to myvariable

my_variable = 200         // Assigns 200 to my_variable

my_variable2 = myvariable + my_variable

                          // my_variable2 = 300

print( “\nsum = “, my_variable2 )

                          // Displays sum = 300 to console

 

Constants

    Constants are numbers or strings of characters.  Constants are the opposite of variables, they do not change.  RobotSee provides three methods of specifying a constant: decimal, hexadecimal, and strings.

    Decimal and Hexadecimal are used to specify numbers. Decimal numbers are specified using the digits 0 through 9. Example: 100, 354, 5289.  Hexadecimal numbers are base 16 numbers containing the digits 0 though 9, and the characters a through f. Hexadecimal numbers are written with a 0x in front of them. Example: decimal 10 = 0xa, decimal 20 = 0x14 ( 16+4 ), decimal 30 = 0x1e ( 16+14 ).

    Strings are used to specify characters. In RobotSee, string are surrounded by paranthesis “”. Example: “This is a String”.

Strings are primarily used by the print() keyword, but also used for serial port operations. Strings are also used by the SAPI dll for text to speech.

 

Operators

    Operators are like verbs, they describe an action. RobotSee supports the C standard operators ( most of them ).  Operators can perform actions on variables, or provide direct input to a keyword. There are 3 classes of operators, mathematical, assignment, and conditional.  As the names suggest, assignment operators assign a value, and conditional operators compare 2 values.  Like C, conditional operators also assign a value, but it’s limited to a 1 or a 0. This may sound a little confusing, but an example will clear it up.

 

Conditional Operator Example

global( result )

result = 10                    // Assigns 10 to result

result = 10 == 10              // Assigns 1 to result

result = 10 == 5               // Assigns 0 to result

 

    The == is a conditional operator that test for equality.  It has to be 2 equal signs == to differentiate it from an assignment operator =, which is 1 equal sign.

 

 

Conditional Operators

    RobotSee supports 6 conditional operators, all of which output a 1 or a 0.    

==    equal comparison              100==5 = 0

!=    not equal comparison          100!=5 = 1

>=    greater then or equal         100>=5 = 1,   100>=100 = 1

<=    less then or equal            5<=100 = 1,   100<=100 = 1

>     greater                       100>5 = 1

<     less then                     100<5 = 0

 

 

Mathmatical Operators

+     addition                      1+1 = 2

-     Subtraction                   1-1 = 0

*     multiplication                2*1 = 2

/     division                      100/10 = 10

%   modulas                       50%9 = 5

>>    shift right                   0x100>>4 = 0x010  // 0x is hexadecimal notation

<<    shift left                    0x010<<4 = 0x100

&     bitwise and                   0xaa&0xf0 = a0

|     bitwise or                    0xaa|0x55 = ff

 

    Most mathematical operators are self explanatory, except for the modulas (%) operator, shift operators, and bitwise operators.  The modulas operator performs a division, and returns the remainder. Example: 100 % 6 = 4. 

The shift operators shift a value either left or right by a x number of bits, where the x is the parameter to the right of the shift operator. 

Example: 64 >> 1 = 32 ( shifts 64 right 1 bit )

    The bitwise operators perform logical operations on the individual bits within a integer.  There are 2 logical operators; or, and.  Or looks like this (|): 1|1=1, 1|0=1, 0|1=1, 0|0=0.  And looks like this(&): 1&1=1, 1&0=0, 0&1=0, 0&0=0.  Notice the difference?  It’s very important that you remember that the bitwise operators (&,|) perform their operations on each bit in the variable.  Although variables store integers, everything in a computer is actually stored as binary.  You see the number as a integer, the computer sees it as a binary number made up of bits.  Example: 18 = 10010

16 = 10000,   18&16 = 10010&10000 = 10000  this is referred to as masking.

 

Assignment Operators

    Programmers hate to type.  As a result, shortcuts are provided to limit the amount of typing.  C contains operators that are a combination of a mathematical operation and an assignment. example: result += 10 is the same as result = result + 10.

=     assignment                    result=5 = 5

+=    addition assignment           result = 100 result+=5 = 105

-=    subtraction assignment        result = 105 result-=5 = 100

*=    multiplication assignment     result = 100 result*=5 = 500

/=    division assignment           result = 500 result/=5 = 100

&=    bitwise and assignment        result = 64 result&=5 = 4

|=    bitwise or assignment         result = 4 result|=5 = 5

 

Logical Operators

    I know I said there were 3 classes of operators, but this is not really a separate class, I just wanted to talk about it separately.  The logical operators are special mathematical operators.  The logical operators perform math on the numbers 1 and 0. Remember that conditional operators create results of 1 and 0.  So, you can think of logical operators as mathematical operators for conditional statements.  Did I blow your mind? Maybe an example will help.

Example:

Result = 10==10 && 10==10      Assigns result = 1

10 == 10 is 1, the && is a logical and operator. It follows the following rules: 1&&1=1, 1&&0=0, 0&&1=0, 0&&0=0

So, 10==10 = 1, 1 && 1 = 1

Result = 10==10 && 10==5       Assigns result = 0

10==10=1, 10==5=0, 1 && 0 = 0

The rules for the logical or || are: 1 || 1=1, 1 || 0=1, 0 || 1 = 1, 0 || 0 = 0.

Result = 10==10 || 10==5       Assigns result = 1

10==10=1, 10==5=0, 1 || 0 = 1

 

RobotSee Keywords

    The power of RobotSee is in it’s keywords.  Each keyword, although easy to use, performs some very complex operations behind the scenes. Keywords add functionality like; computer vision, speech recognition, sound playback, and complex floating point math.  In other languages, advanced functionality is included via libraries.  For RobotSee, I decided not to take the library approach because RobotSee is designed to be simple.  In addition to the keywords that are part of RobotSee, additional keywords can be added via DLL’s.  This allows the language itself to be expanded.

    Keywords are passed data ( called parameters ) between the paranthesis.  All keywords are followed by paranthesis, if a keyword has no parameters then the there is nothing between the paranthesis (). Parameters can be variables, other keywords, expressions, even full statements. Some keywords can even contain variable assignments ( gosub ). Some keywords return integers, so keywords can also be part of an assignment. Following is a list of currently supported keywords.

 

 

 

 

 

 

 

RobotSee Keywords – 08/30/09 ( 6.2 )

Eric Gregori

 

 

Variables – testarray.see

                                    Variable names can only contain alpha characters.

                                    z[0] – z[255] are fast variables, and do not need

                                    to be declared. They are reserved variables.

 

global( variable_name )             - Creates a global variable

local( variable_name )              - Creates a local variable within a subroutine

array( variable_name, size )        - Creates a global variable array of integers

                                      access variables just like in c

                                      var[0] = 100      var[24] = 50

                                      array size only limited by memory

 

enum( name, const1, const2, const3 const4, const5, const6, const7, ... )

 

-    Creates a initialized array of constants

Name is the variable name

And const 1-n,  are constants

This is equivalent to: array( name, n )

               Name[0]     = const1

               Name[1]     = const2

               Name[n-1]   = constn

 

int const( name, index )            -  Reads a array ( name ) at index

                                       This is equivilant to:   name[index]

 

Operators – testoperators.see

 

+     addition                      1+1 = 2

-     Subtraction                   1-1 = 0

*     multiplication                2*1 = 2

/     division                      100/10 = 10

&     bitwise and                   0xaa&0xf0 = a0

|     bitwise or                    0xaa|0x55 = ff

=     assignment                    result=5 = 5

>     greater                       100>5 = 1

<     less then                     100<5 = 0

+=    addition assignment           result = 100 result+=5 = 105

-=    subtraction assignment        result = 105 result-=5 = 100

*=    multiplication assignment     result = 100 result*=5 = 500

/=    division assignment           result = 500 result/=5 = 100

&=    bitwise and assignment        result = 64 result&=5 = 4

|=    bitwise or assignment         result = 4 result|=5 = 5

==    equal comparison              100==5 = 0

!=    not equal comparison          100!=5 = 1

>=    greater then or equal         100>=5 = 1,   100>=100 = 1

<=    less then or equal            5<=100 = 1,   100<=100 = 1

&&    logical and                   100>5&&100>5 = 1

                                    100>5&&100<5 = 0

||    logical or                    100>5||100>5 = 1

                                    100>5||100<5 = 1

100<5||100<5 = 0

>>    shift right                   0x100>>4 = 0x010

<<    shift left                    0x010<<4 = 0x100

 

 

 

Controlling Program Flow – testloops.see

 

while( conditional ) .... wend()

for( assignment ) ... next( conditional )

for( assignment ) ... next( expression, conditional )

if( conditional ) ... endif()

if( conditional ) ... else() ... endif()

switch( expression ) ... case C: ... break() ... default: ... endswitch()

switch( expression ) ... case C: ... break() ... endswitch()

switch( expression ) ... case C: ... endswitch()

goto(label)

gosub( label, return var, expression, expression, ..... )

gosub( label, return var )

return( expression )

end()

 

Multi-Tasking

 

createtask( ".see path/filename" ) - Creates another interpreter instance and loads

                                     it with the SEE program specified.

int mutex( index )                  - Variables used to communicate between instances

int mutex( index, expression )     - Variables used to communicate between instances

 

Logical

 

int and( int, mask )               - returns variable and mask

int or( int, mask )                - returns variable or mask

int rightshift( int, shift )       - shifts variable right

int leftshift( int, shift )        - shifts variable left

 

Time – testtime.see

 

delay( ms )                        - delay for milliseconds

int getms()                        - Get milliseconds since execution started

int time( 0 )                      - returns time in seconds since UTC 1/1/70

int time( 1 )                      - returns 0xWWHHMMSS where: W=weekday, H=hour,                                         M=minute, S=second

int time( 2 )                       - returns 0xYYDDMMOO where: Y=year, D=Day in year,    

  M=Month, O=Day Of Month

 

Math - testmath.see

 

srand( seed )                      - Seed the random number generator

int rand( min, max )               - Returns a random number between min and max

int atanto( mult, div, int, int )  - returns (mult*180*atanto( int/div, int/div ))/pi

int sqrt( mult, int )              - returns mult * sqrt( int )

int asin( mult, div, int )         - returns (mult * 180 * asin( int/div ))/pi

int acos( mult, div, int )        - returns (mult * 180 * acos( int/div ))/pi

int atan( mult, div, int )        - returns (mult * 180 * atan( int/div ))/pi

int tan( mult, div, int )           - returns (mult * tan( ((pi*int)/div )/180 )

int sin( mult, div, int )           - returns (mult * sin( ((pi*int)/div )/180 )

int cos( mult, div, int )           - returns (mult * cos( ((pi*int)/div )/180 )

int abs( int )                      - returns abs( int )

 

int floatmult( mult,div,a,b ) - returns mult*((a/div)*(b/div))

int floatdiv( mult,div,a,b )        - returns mult*((a/div)/(b/div))

 

 

Serial

 

int serpurge( port )                            - Purge the serial port

int serout( port, purge, data )           - Send Data out serial port

int seropen( port, baud )                 - Open the serial port

int serwait( port, "string", timeout )          - Wait for "string" on serial port

int sergethexbyte( port, variable, timeout )    - Read and convert hex data from serial

                                                  port

File I/O – testfileio.see

 

fileprint( "string", expression, "string %x", expression ) - print data to file

fileopen( "filename" )             - open a file

fileclose()                        - close a file

 

Applications Interface

 

int appget( tag, data )       - Get data from Application Interface

int appflush()                     - Flush the Application Interface

int appput( tag, data )       - Send data to Application Interface

 

Sound – testsound.see

 

soundplay( "filename of sound to play" ) - Play a sound file once ( done in background )

soundloop( "filename of sound to play" ) - Loop a sound file ( done in background )

soundstop( )                             - Stop current sound playback

 

Misc

 

print( "string", expression, "string %x", expression ) - print to console

debug( level )                            - turns on debugging, enables breakpoints

verbose( level )                          - sets interpreter console verbose mode level

int loaddll( "dll_path_filename.dll" )    - Loads a language Extension DLL

int version()                             - Returns Interpreter Revision Number

breakpoint( level )                       - When executed, goes into debug mode.

 

Interrupts – testinterrupts.see

 

int interrupts( option )                  -  interrupts(0) - disable all

   interrupts(1) - enable all

 

int interadd( label )                     -  Add a interrupt handler

                                             where: label is the label the interrupt

                                                    will jump to

                                             returns -1 on failure

 

int interstart( label, timeout )          -  Sets timeout ( in ms ) for interrupt

                                             created with interadd()

 

int interstop( label )                    -  Stops the interrupt created with interadd()

   returns -1 on failure

 

int interdel( label )                     -  Deletes a interrupt created with interadd()

interret()                                -  You must use this return in your interrupt

                                             handler.

 

 

 

 

Computer Vision - Language Extension   Many examples in Examples directory

 

int computervision()                      - returns revision number

int visionopen                            - Open vision with specified DLL

visionprint( index )                      - Sends vision strings to console

int visionframe( )                        - returns frame #

visionwait( frames )                     - block for X frames

visionfilter( filter.dll )                - sets a vision filter

int visionread( index )                   - Read vision variables

int visionwrite( index, data )            - write vision variables

visionclose                               - close computer vision instance

 

 

 

 

Speech Recognition / Text to Speech ( SAPI ) - Language Extension – sapitest1.see

 

int sapi()                                - return revision number

int sapiopen()                            - Opens a SAPI interface

int sapiclose()                           - Closes a SAPI interface

int sapilisten()                          - sapilisten( 0=off, 1=on )

int spipoll( "word1", "word2", "word3", "word4", "word5" ) - Listen for these words

int sapispeak( "string to speak" )        - Text to speech

int sapiprint( "string", var, "string", var, "string", var ) - print to SAPI

 

 

Joystick - Language Extension – sapitest1.see

 

int joystick()                                        - returns joystick dll revision

int joystickread( num, x, y, butt )                   - returns 0 if joystick detected.

int joystickread( num, x, y, butt, z, r )               num = joystick number 0 = 1 joy

int joystickread( num, x, y, butt, z, r, pov )          x,y,butt,z,r,pov,u,v  variables

int joystickread( num, x, y, butt, z, r, pov, u, v )    are assigned values based on

                                                        state of joystick.

                                                       Tested using Logitech Dual Action

                                                       See testjoystick.see for examples

 

KevinJr - Language Extension

 

int kevinjr(0)                            - returns kevinjr language extension revision number

int kevinjr(1)                            - returns USB DLL revision number

var( variable_name )                      - Creates a variable

var( variable_name, assignement )         - Creates a variable, and assigns it a value

servos( duty1, duty2, duty3, duty4, duty5, duty6, duty7, duty8 ) - move all servos at once

servo( servo_num, duty )                  - Moves a single servo

leds( led1, led2, led3, led4, led5, led6, led7 ) - led = 0,1,2,3 - 0=off, 1=green, 2=red, 3=yellow

led( led_num, value )                     - single led control

usbopen( "path/filename to USB dll" )     - opens the HID USB DLL

int readtouch( var1, var2, var3 )         - Reads the Touch sensors

int readaccel( var1, var2, var3 )         - Reads the accelerometer

int readsensors( var1, var2, var3, var4, var5, var6 ) - Reads both touch and accel

int iicwrite( address, data )             - Write to iic

int iicread( address )                    - read from iic

 

 

 

RobotSee keywords - continued

 

    As I said in the first part of this section, keywords are passed parameters, and some return integers. The parameters are contained within the paranthesis ().  The returned value is made available for the next operation.  This is tough to understand in writing, so let me show you some examples. Remember the and bitwise operator &?  There is also a keyword that does the same thing.

 

result = and( 18, 16 )         // same as result = 18 & 16

 

The and() keyword returns the result of its operation as a integer.  This mechanism allows keywords to be chained together.  The output of one keyword can be the input to another keyword.

 

Result = or( 1, and( 18,16 ) ) // returns 17 = 18&16|1

 

 

Math Keywords

 

Math - testmath.see

 

srand( seed )                      - Seed the random number generator

int rand( min, max )               - Returns a random number between min and max

int atanto( mult, div, int, int )  - returns (mult*180*atanto( int/div, int/div ))/pi

int sqrt( mult, int )              - returns mult * sqrt( int )

int asin( mult, div, int )         - returns (mult * 180 * asin( int/div ))/pi

int acos( mult, div, int )        - returns (mult * 180 * acos( int/div ))/pi

int atan( mult, div, int )        - returns (mult * 180 * atan( int/div ))/pi

int tan( mult, div, int )           - returns (mult * tan( ((pi*int)/div )/180 )

int sin( mult, div, int )           - returns (mult * sin( ((pi*int)/div )/180 )

int cos( mult, div, int )           - returns (mult * cos( ((pi*int)/div )/180 )

int abs( int )                      - returns abs( int )

 

int floatmult( mult,div,a,b ) - returns mult*((a/div)*(b/div))

int floatdiv( mult,div,a,b )        - returns mult*((a/div)/(b/div))

   

The math keywords also return integers.  Internally, they perform their operations as floating point numbers.  This provides a higher level of precision.  In order to convert the floating point numbers to integers, a multiply and divide mechanism is used. Example:

 

22/7 = 3.1428571428571428571428571428571

 

 int floatdiv( mult,div,a,b )       - returns mult*((a/div)/(b/div))

 

result = floatdiv( 10000, 1, 22, 7 ) = 10000*((22/1)/(7/1))

 

internally, RobotSee performs 22/7 as a floating point operation. Resulting in a internal result of 3.14285714285. RobotSee then multiplies the floating point result by the mult parameter ( 10000 in this example ).  So, the above operation returns 31428.  As you can see, the mult parameter specifies the precision of the result.  If your program needs more precision, use a larger multiplier, if it needs less precision use a smaller multiplier. The div parameter allows for chaining of mathematical operations.  It allows a “emulated” floating point number to be converted internally by RobotSee into a real floating point number.

 

result = floatmult( 1, 10000, 7, floatdiv( 10000, 1, 22, 7 )) = (7/1)*((10000*((22/1)/(7/1)))/10000) = 21 ( should be 21.9996 )

 

    In addition to floating multiply and divide, RobotSee supports the trig functions ( sin, cos, tan, asin, acos, atan, atanto ), sqrt, and abs.

 

 

Program Flow Keywords

 

Controlling Program Flow – testloops.see

 

while( conditional ) .... wend()

for( assignment ) ... next( conditional )

for( assignment ) ... next( expression, conditional )

if( conditional ) ... endif()

if( conditional ) ... else() ... endif()

switch( expression ) ... case C: ... break() ... default: ... endswitch()

switch( expression ) ... case C: ... break() ... endswitch()

switch( expression ) ... case C: ... endswitch()

goto(label)

gosub( label, return var, expression, expression, ..... )

gosub( label, return var )

return( expression )

end()

 

    RobotSee provides 7 keywords to control execution flow. Two of those keywords are used to support subroutines, the other 5 keywords are used for looping and decision making. Every attempt was made to make the looping construct as close to C as possible, but RobotSee is an interpreted language where-as C is a compiled language.  The difference required some tweaking to the C for(), switch(), and if() statements.  If you are new to programming, this will not be an issue.  If you are a C programmer,  the new construct will take a little getting used to.

if() … else() … endif()    or     if() … endif()

 

    Decision making is a critical action done by programs.  In most cases, the whole purpose of a program is to make decisions based in incoming data. RobotSee provides the if() and the switch() keywords for decision making.

    The if() keyword has a mandatory associated keyword endif(), and a optional keyword else().  The if() statement is very similar to C, with the exception of the brackets.  RobotSee does not use brackets like C.  Instead, the endif() keyword terminates the true block of code.

 

if( conditional )

    this code is executed if conditional is true (1)

else()

    this code is executed if conditional is false (0)

endif()

 

or

 

if( conditional )

    this code is executed if conditional is true (1)

endif()

 

    Remember the conditional operators that were discussed in the operator section.  You probably wondered what the point of the 1 or 0 results were.  Well, welcome to the point. 

 

if( myvariable == 1 )         

    print( “Hello World” )    // Display hello world if

endif()                        // myvariable is 1

 

if( myvariable & 0x01 )

    print( “Hello World” )    // Displays hello world if

endif()                        // bit 0 in my variable is 1

 

So, if myvariable = 0x20, 0x20 & 0x01 = 0

If myvariable = 0x21, 0x21 & 0x01 = 1

This is referred to as masking.

 

The conditional is only false if 0, and is considered true for every other value.

 

If( 100 ); print( “hello” ); endif() // will display hello

If( 0 ); print( “hello” ); endif()   // will NOT display hello

 

switch() … case: … break() … endswitch()

 

    The switch() case: construct is a significantly more difficult construct then the if().  It based on the C switch() construct, and was added to RobotSee to support state machines.

The break(), and default: are optional. A switch() construct must have at least 1 case:, the advantage is that it can have many.  RobotSee is designed to process switch() statements quickly.  Direct jumps are used, so switch() case: construct are an efficient decision making tool. As a note, if() also uses a direct jump and is very efficient, this statement was put here to differentiate RobotSee’s switch() from other less efficient languages. The switch() keyword includes a expression instead of a conditional.  The expression is evaluated, and the result is used to determine which case: to jump to.

 

Example:

 

switch( myvariable )

         case 1:

print( “myvariable = 1” )

break()

case 2:

    print( “myvariable = 2” )

break()

         default:

             print( “myvariable  = anything except 1 or 2” )

endswitch()

 

The break() keyword tells RobotSee to jump to the endswitch(). If the break() is omitted ( it optional ) from case 1:, then when myvariable is 1, both case 1: and case 2: will execute.  This is referred to as falling through.  In some cases you may want that. Example: fall through

 

 

 

 

 

 

 

 

 

 

switch( myvariable )

    case 23:

    case 45:

    case 0x35:

    case 1:

    case 6:

         print( “This will print if myvariable is any of the” )

         print( “constants ( 23, 45, 0x35, 1, or 6 )” )

         break()

 

    default:

         print( “This prints for every number not listed above”)

endswitch()

 

 

    As I stated earlier, I included switch() constructs in RobotSee specifically for state machines.  The following is an example of a simple state machine.  State machines will be covered in more detail in the advanced section of this manual.

 

global( state )  // simple state machine

state = 0;

while(1)

switch( state )

    case 0: // state 0 ( home )

         // move leg servos to position 1

         State += 1   // goto next state

         break()

    case 1: // state 1

         // move leg servos to position 2

         State += 1   // goto next state

         break()

    case 2: // state 2

         // move leg servos to position 3

         state += 1   // goto next state

         break()

    case 3: // state 3

         // move leg servos to home

         state = 0    // goto state 0 ( case 0: )

break()

         default:

             // illegal state, goto safe condition

             state = 0

    endswitch()

wend()

Looping - while(), for()

 

    Looping is the action of repeating a set of instruction multiple times.  In most cases, a condition is tested, and the looping continues until the condition is satisfied. Both the while() and the for() keywords can be used for looping.

 

while( conditional ) … wend()

 

         The while() … wend() construct executes the code between the while() and the wend() for as long as the condition is true. The condition is test at the beginning of each loop ( by the while() keyword ) and the while() keyword jumps directly to the wend() if the condition evaluates to false. While() … wend() constructs can be nested. Nesting refers to having one loop within another.  There is no limit ( or depth ) for loop nesting in RobotSee.  Example:

 

myvariable = 0

while( myvariable < 10 ); myvariable += 1; print(“a”); wend()

 

the above statements will display 10 a characters.

 

while( 1 ); print( “hello world” ); wend()

 

This is a infinite loop, displaying hello world forever.

 

 

for( expression ) … next( expression, conditional )

for( expression ) … next( conditional )

 

    The for() … next() construct has a optional expression in the next() keyword.  If you are familiar with C, you will notice that the RobotSee for() is very different from the C for. If you closely, you will notice that although different, the RobotSee for() “matches-up” with the C for.

    The for() construct has 2 mandatory parameters, and a third optional parameters.  The next() keyword is required ( you will get an error of you do not have a matching next() for every for().  Notice the for() tests the conditional after the loop. This is different from the while() that test the conditional before the loop.  This is important if your statements within the loop need to execute at least once.

 

 

global( myvariable )

 

for( myvariable = 0 )     // this expression is only run once

    print( “a” )

next( myvariable += 1, myvariable < 10 )

 

The code above will display ‘a’ 10 times.  The for() keyword initializes myvariable to 0.  The next() keyword FIRST increments the variable, THEN tests the variable. If the condition is true, the next() keyword jumps to the next instruction AFTER the for().  So, the for() instruction only executes once at the beginning of the loop. The result is that myvariable will increment from 0 to 10, but the loop will only execute 10 times.  When the code exits the for() … next() construct, myvariable will equal 10.  This is a common cause of bugs in C programs ( the C for does the same thing ) and will also be a common source of bugs in RobotSee programs.

 

for( myvariable = 100 )

    print( “a” )

next( 0 )

 

    // display ‘a’ once, because the conditional evaluates to 0

 

for( myvariable = 100 )

    print( “a” )

next( myvariable > 0 )

 

    // displays ‘a’ forever, the conditional always evaluates to true

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

goto( label )

 

    Although not good programming practice, RobotSee supports the goto() keyword.  The goto( label ) keyword jumps directly and unconditionally to the label specified.    

    In RobotSee, labels MUST be on a line by themselves, can contain digits, but MUST end with a colon :. Labels can contain up-to 32 characters, and the only limit to the number of labels is the amount of memory available. Example:

 

infiniteloop:             // This is a label named infiniteloop

print(“a”)

goto( infiniteloop )      // This will display ‘a’ forever

 

If you are thinking that labels look similar to the case: statement in the switch construct, then you are correct.  In switch() constructs, case : are in-fact special labels.

 

 

Subroutines – gosub() … return()

gosub( label, return var, expression, expression, ..... )

gosub( label, return var )

return( expression )

 

    Subroutines or functions are important part of programming correctly. Subroutines allow you to write a piece of code once, and use it in many different places.  Subroutines are common in BASIC interpreters, and functions are a fundamental component of C.  RobotSee takes the best of both worlds,  the simplicity of subroutines with the power of functions.  RobotSee adds parameter passing and local variables to simple basic subroutines.  This concept, although described in only a few lines of text here, will make your programs significantly easier to develop, read, and debug.  The idea is to break your programs objectives into parts, and write subroutines for each of those parts.  Then test each subroutine individually, before combining all together in your final program. In addition, once your write and test a subroutine, you can easily cut and paste it into other programs.  This “building block” approach is a fundamental characteristic of good software design.

    To add to the building block approach, RobotSee supports the concept of using multiple files for your programs via the #inlcude directive.  This will allow you to write a subroutine once, and simply #include it into your other programs.  The #include directive will be discussed in the advanced portion of this reference manual. 

    With subroutines, I must introduce the concept of a stack. Keep in mind that you do not have to do anything with the stack directly. RobotSee manages the stack automatically.  The purpose of providing this “how does it work” explanation is to provide a further understanding of what is going on “behind the scenes”.

    A stack is a FILO ( First In Last Out ) memory buffer. As the name stack implies, the memory buffer works similar to a stack of index cards.  To store data on the stack, you write the value on the index card and put it on top of the stack.  This is referred to as pushing onto the stack.  To read data from the stack ( popping ) you take the top index card, and read the value written on it.  So when you here the term “stack” in the following paragraphs, think of a stack of index cards on a table with a single integer written on each index card ( the RobotSee stack stores integers ).

    RobotSee subroutines use the gosub() and return() keywords. Gosub() is used to call the subroutine, and return() is used at the end of the subroutine to “return” to the instruction after the gosub.  This is all automatically handled by the RoboSee interpreter, but internally the gosub() keyword pushes the address of the next instruction on to the stack, and the return() keyword pops that address off the stack and jumps to it.

 

 

global( myvariable )

global( retval )

for( myvariable = 0 )

    gosub( display, retval )  // Jump to display: label

next( myvariable += 1, myvariable < 10 )

end()                          // end() terminates program

 

// display subroutine

display:                       // subroutine is named by a label

print( “\nmyvariable = “, myvariable )

return( 0 )                   

   

In the above example, when the gosub() keyword is executed, RobotSee pushes the address of the next() keyword onto the stack. It also pushes the address of the retval variable on the stack. Then gosub() jumps to the label – display:.

    The subroutine starts with the label – display:. The return(0) at the end of the subroutine will store 0 into the variable retval, then pop the variable off the stack. Then return() pops the address of the stack, and jumps to it.  If you recall, the gosub had pushed the address of the next() instruction onto the stack, so the result is that return(0) jumps to the next() instruction.

 

 

for( myvariable = 0 )

      gosub( display, retval )                        display:

next( myvariable += 1, myvariable < 10 )              print( “\nmyvariable = “,

end()                                                 return( 0 )

 

                

 

    You may be wondering “why use subroutines?” Although the answer is not obvious from these simple examples, the biggest advantage is code reusability.  Using subroutines allows us to write a piece of code once, and re-use it multiple times.  This is a good programming practice because it decreases the chance of adding a bug in code, and also decreases the size of the actual code.

    The return value ( specified in the paranthesis of the return() keyword ) is an integer.  The expression specified within the paranthesis is evaluates, and the result is writtin into the variable name specified by the gosub() keyword.

 

global( myvariable )

for( myvariable = 0 )

    gosub( increment, myvariable )

print( “\nmyvariable = “, myvariable )

next( myvariable < 10 )

end()                         

 

increment:                    

return( myvariable + 1 )                   

 

 


Within RobotSee, myvariable is sent to the subroutine by the gosub() keyword. Then the return() keyword writes to myvariable, the integer result of myvariable + 1.  The net result is myvariable = myvariable + 1.

 

    In addition to returning data from a subroutine, data can be sent to a subroutine.  The data can be sent using either a global or local variable.

 

gosub( label, return var, expression, expression, ..... )

 

    The optional expression parameters in the gosub() keyword allows you to put assignment expressions ( = ) directly in the the gosub() statement.  The intent is to allow you to pass parameters to your subroutine.  Assignments can be to either global variables, or local variables.  If the variable is NOT global, the gosub() keyword will create a local variable of the name specified.  This section will concentrate on global variable usage, I will cover local variables in the advanced section.

 

Example: passing a parameter to s subroutine using a global variable

 

global( myvariable )

global( dump )

gosub( display, dump, myvariable=1 ) 

gosub( display, dump, myvariable=2 ) 

gosub( display, dump, myvariable=3 )

print( “\nMyVariable = “, myvariable )

end()

 

// display subroutine

display:                       // subroutine is named by a label

print( “\nMyvariable = “, myvariable )

return( 0 )                   

 

 

The above program will display: Myvariable = 1

                                 Myvariable = 2

                                 Myvariable = 3

                                 MyVariable = 3

 

Notice, the global variable myvariable is assigned a different value in each gosub() call.  It’s important to note that gosub() is assigning the value specified to a global variable in this case.  You can see the results in the final MyVariable print ( notice the V is capitalized ).  Because myvariable is global, the last assignment done by the gosub() is persistant. This is where local variables have the advantage, local variables allow you to pass parameters without the result being persistant.

 

 

 

Advanced Topics

 

    The whole point of RobotSee is to allow both non-programmers and experienced programmers access to advanced technology.  To do that, RobotSee provides both simple and advanced methods to do the same thing.  For instance a beginner programmer should start without using subroutines. Then as the concepts are understood, start adding subroutines to their programs.  That’s the advantage of RobotSee, it allows you to do that.

    This section “Advanced Topics” is going to cover the more advanced aspects of RobotSee.  You do NOT need to understand these topics to write RobotSee programs.  In-fact, every one of these advanced methods can be done using a simpler method.

                                  

 

 

 

Not Finished

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Debugging your Programs

 

    The RobotSee interpreter includes a built-in debugger. A debugger is a tool used to control execution of your program, and to view and modify variables. Controlling execution mean to be able to stop your program at an instruction, or step through your program one step at a time. In this section we will discuss the debuggers command line interface, but the debugger also has a graphical interface that will be discussed in the next section.

 

Starting the Debugger

 

    The debugger must be enabled by including the keyword debug() at the top of your program.  This was done to avoid the possibility of the debugger be enabled by accident.  In addition, the command line debugger requires that you include a breakpoint() keyword in your program.  This is NOT required when using the graphical debugger.

 

Example: Enabling Debugging in the ForWhileIf Example

 

debug(1)          // Enables debugger

 

global( myvariable )

                               

myvariable = 0

print( "\nBit masking example using a while() loop" )

while( myvariable < 0x10 )

      breakpoint(1)     // Stop and debug

      print( "\nmyvariable = 0x%x", myvariable, " - " )  // Line 26 in source file

      if( myvariable & 0x10 ); print( "bit 4 is high," ); endif()

      if( myvariable & 0x08 ); print( "bit 3 is high," ); endif()

      if( myvariable & 0x04 ); print( "bit 2 is high," ); endif()

      if( myvariable & 0x02 ); print( "bit 1 is high," ); endif()

      if( myvariable & 0x01 ); print( "bit 0 is high," ); endif()

      myvariable += 1

wend()

 

global( bitmask )

global( bitnum )

print( "\nBit masking example using nested for() loops" )

for( myvariable = 0 )

      breakpoint(2)     // Stop and debug

      print( "\nmyvariable = 0x%x", myvariable, " - " )

      for( bitnum = 0 )

            bitmask = 0x01<<bitnum

            if(  myvariable & bitmask ); print( "bit ", bitnum, " is high," ); endif()

      next( bitnum += 1, bitnum < = 5 )

next( myvariable += 1, myvariable < 0x10 )

 

 

 

Run the .see program just like you would run any other .see program ( in this case just click on the ExampleDebugging.bat file ).

The debugger was enabled by the debug(1) command at the beginning of the ExampleDebugging.see file.  Then the .see program executed until it hit the breakpoint(1) keyword.  The breakpoint(1) keyword halted execution, and invoked the command line debugger. When in debug mode,  you will see a DEBUG> prompt in the console window. Below is the information the debugger output to the console window when execution was halted.

 

This is a line out of the .see file. This line HAS NOT EXECUTED YET.  In this case, this line is right after the breakpoint(1) instruction.

 
 


Bit masking example using a while() loop

( 131 ) print("\nmyvariable = 0x%x",myvariable," - ")

file = ExampleDebugging.see  line = 8  sline= 26  index= 131

The “sline = “ field tells you the Source code line number. You can use this to find the line in your .see file using your text editor.

 

The “file =” field tells you the filename of the .see file you are debugging.

 

The Debug> prompt tells you that you are halted, and the debugger is waiting for you to type a command.

 
DEBUG>

 

 

 

Using the sline = field

    In large .see programs, it may be hard to find exactly what line of code you are halted at.  The debugger will tell you what the NEXT line to execute is, but that may not help if the line is not unique, or you just cannot find it in a long .see listing.

    The sline = field provides the line number of the NEXT INSTRUCTION TO EXECUTE in the source .see file. Using the above example, ( 131 ) print("\nmyvariable = 0x%x",myvariable," - ")  is the NEXT line to execute, and it is the 26th line from the top of the .see file.  If you are using a text editor that allows you to goto a line number, you can use the sline line number to go directly to the line in your source file.

 

 

 

 

 

 

 

Debugger Commands

    At the DEBUG> prompt, type ? then hit enter.  This will display a list of available debugger commands.  All the commands start with a single character. The <cr> just means hit the enter key. Values can be entered in decimal or hexadecimal ( use 0x prefix ).

 

The Trace Buffer

    The RobotSee interpreter has a 31 line deep trace buffer.  A trace buffer keeps a record of the last lines executed ( 31 as of the current revision ).  This information can be very helpful when trying to debug a problem.  It tells you what your .see program was doing.  To see the contents of the trace buffer, use the ‘t’ command at the DEBUG> prompt.

 

Format: ( source line number ) = source line

Oldest line at the top, most recent line at the bottom.

 

 

 

 

 

Error Log

    In addition to the debugger, the RobotSee interpreter also includes an error log generator.  A error log file ( errorlog.txt ) is created when the interpreter catches an error that requires the interpreter to shutdown.

 

Below I have created an error in a .see program.

 

 

 

 

 

 

 

 

 

 

 

Contents of the errorlog.txt file from the above bug

 

!ERROR! -> Variable NOT FOUND (mybug)

on line: bitmask=0x01<<mybug

 

 

Trace Information

 

        if(myvariable&0x01)

        print("bit 0 is high,")

        myvariable+=1

        wend()

        global(bitmask)

        print("\nmyvariable = 0x%x",myvariable," - ")

        if(myvariable&0x10)

        print("bit 4 is high,")

        if(myvariable&0x08)

        print("bit 3 is high,")

        endif()

        if(myvariable&0x04)

        print("bit 2 is high,")

        endif()

        if(myvariable&0x02)

        print("bit 1 is high,")

        endif()

        if(myvariable&0x01)

        print("bit 0 is high,")

        endif()

        myvariable+=1

        wend()

        global(bitmask)

        print("\nmyvariable = 0x%x",myvariable," - ")

        global(bitnum)

        print("\nBit masking example using nested for() loops")

        for(myvariable=0)

        print("\nmyvariable = 0x%x",myvariable," - ")

        for(bitnum=0)

here -> bitmask=0x01<<mybug

        if(myvariable&bitmask)

 

 

 

The here -> specifies the line of code that caused the interpreter to stop execution.  Notice in this example, I am using a variable name that I did not create previously.

 

 

 

 

 

The RobotSee IDE ( Integrate Development Envirionment )

    Everything we have seen so far has been using the command line interface.  RobotSee can be written, executed, and debugged using Graphical User Interface ( GUI ).  This GUI is called a IDE because it allows you to do everything from a single tool.

You can open the IDE by clicking on the: RobotSeeGui_Version_0_5.exe file in the RobotVisionToolkit directory.

 

 

 

 


 

The IDE also includes tools to help test your programs.

 

 

 

 

 

DataGrapherUI – tools->Data Grapher

    The data grapher User Interface allows you to graph variables in your .see programs in real-time.  This allows you to view what your programs are doing graphically in real-time.

 

The above example illustrates plotting the variables named: plota, plotb, and plotc.  You will find the RobotSeeScripts directory, testgrapher.see.

Example Program: HelloWorld.see

// This is a comment. Comments start with // and end at the end of the line

//---------------------------------------------------------------------------------------------------

// RobotSee HelloWorld example by Eric Gregori ( www.EMGRobotics.com )

// For additional help with RobotSee goto: http://groups.google.com/group/robotsee-users

// The RobotSee Reference manual can be found here: www.robotsee.com

// The RobotVisionToolkit reference manual can be found here: www.robotvisiontoolkit.com

//---------------------------------------------------------------------------------------------------

// The \n tells the print to write the string on a new line.

print( "\n\n\n\n\n\n\n\n\n\n\nHello World" )

delay( 10000 )                           // wait 10 seconds

// Now, isn’t that simple

// print is a keyword.  All keywords are followed by paranthesis ().

// "\nHello World" is a string.  Strings are enclosed in paranthesis ""

// A parameter is a piece of data between the (), that is passed to the

// keyword. For the print(), the data was the "\nHello World" string.

// For the delay(), the parameter was the integer 10000.

 

print( "\nNow lets try a simple loop" )

 

// In the following example, we will use a label and the goto() keyword

// to do a infinite loop.

 

infiniteloop:

print( "\nYou must close the window to terminate this program" )

delay( 1000 )              // wait 1 second

goto( infiniteloop )

 

 

 

 

 

 

 

Example Program: HelloWorld.see   ( continued )

 


 

 

Example Program: ExampleVariable.see

 

//---------------------------------------------------------------------------------------------------

// RobotSee Variables example by Eric Gregori ( www.EMGRobotics.com )

//

// Variables are declared using the global() keyword. The variable_name can be up to 32 characters,

// and can contain digits or a '_'.  The variable name must start with a alpha character.

// Variables names must also be lower case ( upper-case characters are converted to lower-case ).

// All variables are 32bit signed integers, with possible values from -2147483647 to +2147483647

//

// global( variable_name )                  // creates a variable named variable_name

//

// For additional help with RobotSee goto: http://groups.google.com/group/robotsee-users

// The RobotSee Reference manual can be found here: www.robotsee.com

// The RobotVisionToolkit reference manual can be found here: www.robotvisiontoolkit.com

//---------------------------------------------------------------------------------------------------

 

print( "\n\n\n\nInterpreter Version" )          // print() displays a string "" to the console

version()                                   // Display the interpreter version string to the console

 

global( robotsee )                          // Creates a variable named robotsee

global( robotsee1 )                         // Creates a variable named robotsee1

global( robot_see )                         // Creates a variable named robot_see

global( robot1see )                         // Creates a variable named robot1see

global( MyRobotSee )                        // Creates a variable named myrobotsee ( caps removed )

// global( 1robotsee )                          // This is a illegal variable

 

robotsee   = 1                                     // Assigns the variable robotsee, the value of 1

robotsee1  = 2147483647                     // Assigns the variable robotsee1, the max positive value

robot_see  = -2147483647                    // Assigns the variable robotsee1, the max negative value

myrobotsee = robotsee + 1                   // Caps in variable names are converted to lower-case

robot1see  = myrobotsee + robotsee        

 

print( "\nThe print() statement displays the string of characters between the quotes" )

print( "\nto the console window." )                // \n tells the print() keyword to display on the next line

 

print( "\nrobotsee = ", robotsee )          // Displays robotsee = the value of the robotsee variable

                                            // to the console.

 

print( "\nrobotsee1 = ", robotsee1 )

print( "\nrobot_see = ", robot_see )

print( "\nmyrobotsee = ", myrobotsee )

print( "\nrobot1see = ", robot1see )

 

                                            // Variables can contain numbers from -2147483647 to 2147483647

                                            // If you attempt to store a number larger or smaller, the

                                            // variable

                                            // will overflow.  This will produce incorrect results.

global( overflow_test )

overflow_test = robotsee1 + 1

print( "\nexample of variable overflow   robotsee1 + 1 -> ", robotsee1, " + 1 = ", overflow_test )

 

overflow_test = robot_see - 1

print( "\nexample of variable overflow   robot_see - 1 -> ", robot_see, " - 1 = ", overflow_test )

 

                                            // As you can see, the overflow results in the sign being

                                            // flipped.

 

global( result )          

                                            // conditional operator example

result = 10

print( "\nresult = ", result )              // Displays  result = 10

 

result = 10 == 10                                

print( "\nresult = ", result )              // Displays  result = 1

 

result = 10 == 5

print( "\nresult = ", result )              // Displays  result = 0

 

 

 

 

 

 

 

Example Program: ExampleVariable.see   ( continued )

 

 

 


 

Example Program: ExampleForWhileIf.see

 

//---------------------------------------------------------------------------------------------------

// RobotSee ForWhileIf example by Eric Gregori ( www.EMGRobotics.com )

//

// For additional help with RobotSee goto: http://groups.google.com/group/robotsee-users

// The RobotSee Reference manual can be found here: www.robotsee.com

// The RobotVisionToolkit reference manual can be found here: www.robotvisiontoolkit.com

//---------------------------------------------------------------------------------------------------

 

global( myvariable )

 

// Bit masking example using the & operator

 

// bits               76543210

// hex value          00000001  = 0x01

// hex value          00000010  = 0x02

// hex value          00000100  = 0x04

// hex value          00001000  = 0x08

// hex value          00010000  = 0x10

                               

myvariable = 0

print( "\nBit masking example using a while() loop" )

while( myvariable < 0x10 )

       print( "\nmyvariable = 0x%x", myvariable, " - " )

       if( myvariable & 0x10 ); print( "bit 4 is high," ); endif()

       if( myvariable & 0x08 ); print( "bit 3 is high," ); endif()

       if( myvariable & 0x04 ); print( "bit 2 is high," ); endif()

       if( myvariable & 0x02 ); print( "bit 1 is high," ); endif()

       if( myvariable & 0x01 ); print( "bit 0 is high," ); endif()

       myvariable += 1

wend()

 

global( bitmask )

global( bitnum )

print( "\nBit masking example using nested for() loops" )

for( myvariable = 0 )

       print( "\nmyvariable = 0x%x", myvariable, " - " )

       for( bitnum = 0 )

              bitmask = 0x01<<bitnum

              if(  myvariable & bitmask ); print( "bit ", bitnum, " is high," ); endif()

       next( bitnum += 1, bitnum < = 5 )

next( myvariable += 1, myvariable < 0x10 )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Example Program: ExampleForWhileIf.see      ( continued )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Example Program: ExampleArrayLowPassFilter.see

 

In this example, an array, subroutines, and local variables are used to demonstrate a digital low-pass filter.

 

//-------------------------------------------------------------------------------------------------

// RobotSee Array example by Eric Gregori ( www.EMGRobotics.com )

//

// Array are declared using the array() keyword. The array_name can be up to 32 characters,

// and can contain digits or a '_'.  The array name must start with a alpha character.

// Array names must also be lower case ( upper-case characters are converted to lower-case ).

// All arrays contain 32bit signed integers, with possible values from -2147483647 to +2147483647

// The size of the array ( number of integers ) is limited only by the amount of memory available.

// Arrays are created dynamically.  If an array is created within a subroutine, it is considered

// to be local in scope.  which means the array will be deleted when the subroutine returns.

//

// array( array_name, size )                      // creates a array named variable_name of size ints

//

// For additional help with RobotSee goto: http://groups.google.com/group/robotsee-users

// The RobotSee Reference manual can be found here: www.robotsee.com

// The RobotVisionToolkit reference manual can be found here: www.robotvisiontoolkit.com

//-------------------------------------------------------------------------------------------------

 

print( "\n\n\n\nInterpreter Version" )     // print() displays a string "" to the console

version()                                   // Display the interpreter version string to the console

 

global( input_index )

global( varsin  )

global( degrees )

global( filter_output )

global( frequency )

global( state )

global(i)

 

input_index  = 0

frequency    = 10

state = 0

array( filo, 32 )

 

// zero out array

for( i=0 ); filo[i]=0; next( i+=1, i<32 )

 

print( "\nExample: Digital Low Pass Filter written in RobotSee using arrays" )

 

while( 1 )

       for( degrees = 0 )

              // int sin( mult, div, angle_in_deg ) - > returns (mult * sin( ((180*deg)/div )/pi )

              varsin = sin( 100, 1, degrees )

              gosub( low_pass_filter, filter_output, filter_input = varsin )

              print( "\ninput = ",varsin, "  output = ", filter_output  )

              delay( 100 )

       next( degrees += frequency, degrees<361 )

 

                if( state == 0 ); frequency += 1; if( frequency >= 50 ); state=1; endif(); endif()

                if( state == 1 ); frequency -= 1; if( frequency <=5 ); state=0; endif(); endif()

wend()

end()

 

low_pass_filter:

local( i )

local( sum )

filo[input_index+=1] = filter_input

if( input_index == 31 ); input_index = 0; endif()

sum = 0

for( i=0 ); sum += filo[i]; next( i+=1, i<32 )

return( sum /= 32 )

 

 

Example Program: ExampleArrayLowPassFilter.see  ( continued )

 

 

 

 


 

http://www.robotsee.com/robot_head_ad5_small.jpg

RobotSee Keyword Datasheet

By Eric Gregori

( www.EMGRobotics.com )

Copyright 2009

 

http://www.robotsee.com/robot_head_ad5_small.jpg

global( variable_name )

 

local( variable_name )

 

array( variable_name, size )

 

z[0] – z[255]

 

enum( name, const1, const2, const3 const4, const5, const6, const7, ... )

 

int const( name, index )

 

Operators   + - * / =

 

Operators   == !=  > >= < <=

 

Operators   += -= *= /=

 

Operators   &  |

 

Operators   &= |=

 

Operators   && ||

 

Operators   >> <<

 

print( "string", expression, "string %x", expression )

 

delay( number of ms )

 

int version()

 

debug( 0 or 1 )

 

breakpoint( breakpoint # )

 

int loaddll( "dll_path_filename.dll" )

 

verbose( level )                          

 

soundplay( "filename of sound to play" )

 

soundloop( "filename of sound to play" )

 

soundstop( )     

 

fileprint( "string", expression, "string %x", expression )

 

fileopen( "filename" )

 

fileclose()

 

 

 

 


 

global( variable_name )        Creates a global variable integer

 

 


Description: Creates a global variable named – variable_name.

Parameters:  Variable name is a string of characters, digits,

             or ‘_’ up to 32 characters long.

             Variable names cannot start with digits.

             Variable names must be unique.

             Capitalization is ignored, variable names are

             converted to lower case.

             All variable are integers in RobotSee.

 

Global variables can be created anywhere in your .see file, but the RobotSee interpreter actually creates all the global variables before it starts executing your program ( the interpreter is a multi-pass parser ).

 

Example:

 

global( myvariable )

global( my_variable )

global( myvariable1 )

global( MyVariable )  // creates a variable named “myvariable”

global( 9myvariable ) // Error

global( counter )

global( counter1 )

global( counter2 )

global( this-will_not_work ) // hyphens are illegal in var names


 

local( variable_name )         Creates a local variable integer

 

 


Description: Creates a local variable named – variable_name.

Parameters:  Variable name is a string of characters, digits,

             or ‘_’.

             Variable names cannot start with digits.

             Variable names must be unique*.

             Capitalization is ignored, variable names are

             converted to lower case.

             All variable are integers in RobotSee.

             The length of a local variable name depends

             on the subroutine name.  The subroutine name

             is appended to the variable name with a ‘-‘. The

             combined strings and ‘-‘ must be 32 chars or less.

 

The RobotSee interpreter allocates space for local variables at run-time within the local() keyword.  The return() keyword then removes the local variables associated with the subroutine from the heap.

 

* Local variable names only need to be unique within the subroutine that they are created in.  A variable named counter in subroutineA is completely different then a variable named counter in subroutineB.

 

Example:

 

global( myvariable )

global( retval )

 

for( myvariable = 0 )

      gosub( sub1, retval, addto=myvariable )

      print("\nmyvariable = ", myvariable, " sub1 retval = ", retval)

      gosub( sub2, retval, addto=myvariable )

      print( " sub2 retval = ", retval )

next( myvariable+=1, myvariable<10 )

end()

 

sub1:

local( counter )      // this is a different variable then counter in sub2

counter = addto*10    // addto is a local var created by gosub

return( counter )

 

sub2:

local( counter )      // this is a different variable then counter in sub2

counter = addto*11    // addto is a local var created by gosub

return( counter )

 

 


 

local( variable_name )                 ( example results)

 

 

 



 

array( variable_name, size )   Creates an array of size integers

 

 


Description: Creates a variable array of integers elements.

Parameters:  Array name is a string of characters, digits,

             or ‘_’.

             Array names cannot start with digits.

             Array names must be unique*.

             Capitalization is ignored, array names are

             converted to lower case.

             All arrays are integers in RobotSee.

             Arrays are accessed using brackets ( C notation ).

             The size of the array is limited by the amount of

             available memory.

 

The RobotSee interpreter allocates space for arrays at run-time within the array() keyword. 

 

* Array names only need to be unique within the subroutine that they are created in.  A array named data in subroutineA is completely different then a array named data in subroutineB.

 

Example:

 

global( input_index )

global( varsin  )

global( filter_output )

global(i)

 

input_index  = 0

frequency    = 10

array( filo, 32 )

 

// zero out array

for( i=0 ); filo[i]=0; next( i+=1, i<32 )

 

print( "\nExample: Digital Low Pass Filter written in RobotSee using arrays" )

while( 1 )

       for( degrees = 0 )

              varsin = sin( 100, 1, degrees )

              gosub( low_pass_filter, filter_output, filter_input = varsin )

              print( "\ninput = ",varsin, "  output = ", filter_output  )

              delay( 100 )

       next( degrees += 10, degrees<361 )

wend()

end()

 

low_pass_filter:

local( i )

local( sum )

filo[input_index+=1] = filter_input

if( input_index == 31 ); input_index = 0; endif()

sum = 0

for( i=0 ); sum += filo[i]; next( i+=1, i<32 )

return( sum /= 32 )

 

 

 

 

 

array( variable_name, size )                    ( continued )

 

 


 

 

 


 

z[0] – z[255]

 

 


Description: A pre-created array that provides FAST access.

Parameters:  None

 

RobotSee is a interpreted language. Normally when a variable is accessed, the interpreter has to perform a search for the variable name. This process takes time. The z[] array is a special case. Any element in the z[] array is accessed significantly faster than a variable created with local() or global().

The z[] array contains 256 integers – z[0] to z[255].  You do not have to create the z[] array, it is pre-created.

 

In the following example you will notice that the z[] array is not created by a array() keyword. You do not have to, it is created automatically by RobotSee.

 

z[] variables are ideal for use as counters. Traditionally; I, j, k, or l are used by C programmers.

 

Example:

 

// Use a fast variable – Notice, no array( z, 255 ) required!

for( z[0] = 0 )

    z[1] = 10-z[0]

    print( "\nz[0]=", z[0], "  z[1]=", z[1] )

next( z[0] += 1 ,z[0]<5)

 

 

 


 

enum( name, const1, const2, const3 const4, const5, const6, const7, ... constn )

 

 


Description: Creates a initialized array.

Parameters:  name     = name of array

             Const1-n = up to 32 constants to initialize array.

 

This keyword was designed to store constants for data like servo positions.  This is the RobotSee version, of #define in C.

This keyword is equivilant to the following code:

 

array( name, n )

name[0]   = const1

name[1]   = const2

name[n-1] = constn

 

 

Example:

 

enum( kelly, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190 )

 

global( josh )

for( ericec = 0 )

      josh = const( kelly, ericec )

      print( "\nindex = ", ericec, " -> const = ", josh )

      print( “\nkelly[“, ericec, “] = “, Kelly[ericec] )

next( ericec=ericec+1, ericec < 10 )

 

 

 

 

 

int const( name, index )

 

 


Description: Keyword to read an array, equivilant to name[index]

Parameters:  name     = name of array

             Index    = index into the array

 

Returns:     The integer at index in the array – name[index]

 

 

Example:

 

enum( kelly, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190 )

 

global( josh )

for( ericec = 0 )

      josh = const( kelly, ericec )

      print( "\nindex = ", ericec, " -> const = ", josh )

      print( “\nkelly[“, ericec, “] = “, Kelly[ericec] )

next( ericec=ericec+1, ericec < 10 )

 

 

 

 

 

 

 

 

 

 

 

Operators   + - * / =

 

 


Description:

+   addition                  1+1 = 2

-   Subtraction               1-1 = 0

*   multiplication            2*1 = 2

/   division                  100/10 = 10

=   assignment                result=5 = 5

 

Parameters:  None

 

Example: ( testoperators.see ) see results after operator sect

 

global( parma )

global( parmb )

global( result )

result = 4

print( "\nresult = %x", result, " result|=5 = %x", result|=5 )

print( "\n1+1 = ", 1+1 )

print( "\n-1+1 = ", -1+1 )

print( "\n1-1 = ", 1-1 )

print( "\n2*1 = ", 2*1 )

print( "\n100/10 = ", 100/10 )

print( "\n100>5 = ", 100>5 )

print( "\n100<5 = ", 100<5 )

print( "\n100>=5 ->", 100>=5 )

print( "\n100<=5 ->", 100<=5 )

print( "\n100>=100 ->", 100>=100 )

print( "\n100<=100 ->", 100<=100 )

print( "\n0xaa&0xf0 = %x", 0xaa&0xf0 )

print( "\n0xaa|0x55 = %x", 0xaa|0x55 )

print( "\nresult=5 = ", result=5 )

print( "\n100!=5 = ", 100!=5 )

print( "\n100==5 = ", 100==5 )

result = 100

print( "\nresult = ", result, " result+=5 = ", result+=5 )

print( "\nresult = ", result, " result-=5 = ", result-=5 )

print( "\nresult = ", result, " result*=5 = ", result*=5 )

print( "\nresult = ", result, " result/=5 = ", result/=5 )

print( "\nresult = %x", result, " result&=5 = %x", result&=5 )

parma = 100

parmb = 5

print( "\n", parma,"+", parmb," = ", parma+parmb )

print( "\n", parma,"-", parmb," = ", parma-parmb )

print( "\n", parma,"*", parmb," = ", parma*parmb )

print( "\n", parma,"/", parmb," = ", parma/parmb )

print( "\n", parma,">", parmb," = ", parma>parmb )

print( "\n", parma,"<", parmb," = ", parma<parmb )

print( "\n %x", parma,"& %x", parmb," = %x", parma&parmb )

print( "\n %x", parma,"| %x", parmb," = %x", parma|parmb )

print( "\n", parma,"==", parmb," = ", parma==parmb )

print( "\n", parma,"!=", parmb," = ", parma!=parmb )

print( "\n", parma,"+=", parmb," = ", parma+=parmb )

print( "\n", parma,"-=", parmb," = ", parma-=parmb )

print( "\n", parma,"*=", parmb," = ", parma*=parmb )

print( "\n", parma,"/=", parmb," = ", parma/=parmb )

print( "\n %x", parma,"&= %x", parmb," = %x", parma&=parmb )

print( "\n %x", parma,"|= %x", parmb," = %x", parma|=parmb )

print( "\n", parma,"=", parmb," = ", parma=parmb )

print( "\n 100>5&&100>5 = ", 100>5&&100>5 );

print( "\n 100>5&&100<5 = ", 100>5&&100<5 )

print( "\n 100<5&&100>5 = ", 100<5&&100>5 );

print( "\n 100>5||100>5 = ", 100>5||100>5 );

print( "\n 100>5||100<5 = ", 100>5||100<5 )

print( "\n 100<5||100>5 = ", 100<5||100>5 )

print( "\n 100<5||100<5 = ", 100<5||100<5 );

print( "\n 0x400>>8 = %x", 0x400>>8 )

print( "\n 0x400<<8 = %x", 0x400<<8 )

Operators   == !=  > >= < <=

 

Description:

==  equal comparison          100==5 = 0

!=  not equal comparison      100!=5 = 1

>   greater                   100>5 = 1

>=  greater then or equal     100>=5 = 1,   100>=100 = 1

<   less then                 100<5 = 0

<=  less then or equal        5<=100 = 1,   100<=100 = 1

 

Parameters:  None

 

Example:

global( parma )

global( parmb )

global( result )

result = 4

print( "\nresult = %x", result, " result|=5 = %x", result|=5 )

print( "\n1+1 = ", 1+1 )

print( "\n-1+1 = ", -1+1 )

print( "\n1-1 = ", 1-1 )

print( "\n2*1 = ", 2*1 )

print( "\n100/10 = ", 100/10 )

print( "\n100>5 = ", 100>5 )

print( "\n100<5 = ", 100<5 )

print( "\n100>=5 ->", 100>=5 )

print( "\n100<=5 ->", 100<=5 )

print( "\n100>=100 ->", 100>=100 )

print( "\n100<=100 ->", 100<=100 )

print( "\n0xaa&0xf0 = %x", 0xaa&0xf0 )

print( "\n0xaa|0x55 = %x", 0xaa|0x55 )

print( "\nresult=5 = ", result=5 )

print( "\n100!=5 = ", 100!=5 )

print( "\n100==5 = ", 100==5 )

result = 100

print( "\nresult = ", result, " result+=5 = ", result+=5 )

print( "\nresult = ", result, " result-=5 = ", result-=5 )

print( "\nresult = ", result, " result*=5 = ", result*=5 )

print( "\nresult = ", result, " result/=5 = ", result/=5 )

print( "\nresult = %x", result, " result&=5 = %x", result&=5 )

parma = 100

parmb = 5

print( "\n", parma,"+", parmb," = ", parma+parmb )

print( "\n", parma,"-", parmb," = ", parma-parmb )

print( "\n", parma,"*", parmb," = ", parma*parmb )

print( "\n", parma,"/", parmb," = ", parma/parmb )

print( "\n", parma,">", parmb," = ", parma>parmb )

print( "\n", parma,"<", parmb," = ", parma<parmb )

print( "\n %x", parma,"& %x", parmb," = %x", parma&parmb )

print( "\n %x", parma,"| %x", parmb," = %x", parma|parmb )

print( "\n", parma,"==", parmb," = ", parma==parmb )

print( "\n", parma,"!=", parmb," = ", parma!=parmb )

print( "\n", parma,"+=", parmb," = ", parma+=parmb )

print( "\n", parma,"-=", parmb," = ", parma-=parmb )

print( "\n", parma,"*=", parmb," = ", parma*=parmb )

print( "\n", parma,"/=", parmb," = ", parma/=parmb )

print( "\n %x", parma,"&= %x", parmb," = %x", parma&=parmb )

print( "\n %x", parma,"|= %x", parmb," = %x", parma|=parmb )

print( "\n", parma,"=", parmb," = ", parma=parmb )

print( "\n 100>5&&100>5 = ", 100>5&&100>5 );

print( "\n 100>5&&100<5 = ", 100>5&&100<5 )

print( "\n 100<5&&100>5 = ", 100<5&&100>5 );

print( "\n 100>5||100>5 = ", 100>5||100>5 );

print( "\n 100>5||100<5 = ", 100>5||100<5 )

print( "\n 100<5||100>5 = ", 100<5||100>5 )

print( "\n 100<5||100<5 = ", 100<5||100<5 );

print( "\n 0x400>>8 = %x", 0x400>>8 )

print( "\n 0x400<<8 = %x", 0x400<<8 )


Operators   += -= *= /=

 

 


Description:

+=  addition assignment           result = 100 result+=5 = 105

-=  subtraction assignment         result = 105 result-=5 = 100

*=  multiplication assignment     result = 100 result*=5 = 500

/=  division assignment           result = 500 result/=5 = 100

 

Parameters:  None

 

Example:

global( parma )

global( parmb )

global( result )

result = 4

print( "\nresult = %x", result, " result|=5 = %x", result|=5 )

print( "\n1+1 = ", 1+1 )

print( "\n-1+1 = ", -1+1 )

print( "\n1-1 = ", 1-1 )

print( "\n2*1 = ", 2*1 )

print( "\n100/10 = ", 100/10 )

print( "\n100>5 = ", 100>5 )

print( "\n100<5 = ", 100<5 )

print( "\n100>=5 ->", 100>=5 )

print( "\n100<=5 ->", 100<=5 )

print( "\n100>=100 ->", 100>=100 )

print( "\n100<=100 ->", 100<=100 )

print( "\n0xaa&0xf0 = %x", 0xaa&0xf0 )

print( "\n0xaa|0x55 = %x", 0xaa|0x55 )

print( "\nresult=5 = ", result=5 )

print( "\n100!=5 = ", 100!=5 )

print( "\n100==5 = ", 100==5 )

result = 100

print( "\nresult = ", result, " result+=5 = ", result+=5 )

print( "\nresult = ", result, " result-=5 = ", result-=5 )

print( "\nresult = ", result, " result*=5 = ", result*=5 )

print( "\nresult = ", result, " result/=5 = ", result/=5 )

print( "\nresult = %x", result, " result&=5 = %x", result&=5 )

parma = 100

parmb = 5

print( "\n", parma,"+", parmb," = ", parma+parmb )

print( "\n", parma,"-", parmb," = ", parma-parmb )

print( "\n", parma,"*", parmb," = ", parma*parmb )

print( "\n", parma,"/", parmb," = ", parma/parmb )

print( "\n", parma,">", parmb," = ", parma>parmb )

print( "\n", parma,"<", parmb," = ", parma<parmb )

print( "\n %x", parma,"& %x", parmb," = %x", parma&parmb )

print( "\n %x", parma,"| %x", parmb," = %x", parma|parmb )

print( "\n", parma,"==", parmb," = ", parma==parmb )

print( "\n", parma,"!=", parmb," = ", parma!=parmb )

print( "\n", parma,"+=", parmb," = ", parma+=parmb )

print( "\n", parma,"-=", parmb," = ", parma-=parmb )

print( "\n", parma,"*=", parmb," = ", parma*=parmb )

print( "\n", parma,"/=", parmb," = ", parma/=parmb )

print( "\n %x", parma,"&= %x", parmb," = %x", parma&=parmb )

print( "\n %x", parma,"|= %x", parmb," = %x", parma|=parmb )

print( "\n", parma,"=", parmb," = ", parma=parmb )

print( "\n 100>5&&100>5 = ", 100>5&&100>5 );

print( "\n 100>5&&100<5 = ", 100>5&&100<5 )

print( "\n 100<5&&100>5 = ", 100<5&&100>5 );

print( "\n 100>5||100>5 = ", 100>5||100>5 );

print( "\n 100>5||100<5 = ", 100>5||100<5 )

print( "\n 100<5||100>5 = ", 100<5||100>5 )

print( "\n 100<5||100<5 = ", 100<5||100<5 );

print( "\n 0x400>>8 = %x", 0x400>>8 )

print( "\n 0x400<<8 = %x", 0x400<<8 )

 


Operators   &  |

 

 


Description:

&   bitwise and               0xaa&0xf0 = a0

|   bitwise or                0xaa|0x55 = ff

 

Parameters:  None

 

Truth Tables:

 

AND truth table: 1 & 1 -> 1

1 & 0 -> 0

0 & 1 -> 0

0 & 0 -> 0

 

OR truth table:  1 | 1 -> 1

                 1 | 0 -> 1

                 0 | 1 -> 1

                 0 | 0 -> 0

 

Example:

 

global( myvariable )

 

// Bit masking example using the & operator

 

// bits               76543210

// hex value          00000001  = 0x01

// hex value          00000010  = 0x02

// hex value          00000100  = 0x04

// hex value          00001000  = 0x08

// hex value          00010000  = 0x10

                               

myvariable = 0

print( "\nBit masking example using a while() loop" )

while( myvariable < 0x10 )

    print( "\nmyvariable = 0x%x", myvariable, " - " )

    if( myvariable & 0x10 ); print( "bit 4 is high," ); endif()

    if( myvariable & 0x08 ); print( "bit 3 is high," ); endif()

    if( myvariable & 0x04 ); print( "bit 2 is high," ); endif()

    if( myvariable & 0x02 ); print( "bit 1 is high," ); endif()

    if( myvariable & 0x01 ); print( "bit 0 is high," ); endif()

    myvariable += 1

wend()


Operators   &= |=

 

 


Description:

&=  bitwise and assignment    result = 64 result&=5 = 4

|=  bitwise or assignment     result = 4 result|=5 = 5

 

Parameters:  None

 

Example:

global( parma )

global( parmb )

global( result )

result = 4

print( "\nresult = %x", result, " result|=5 = %x", result|=5 )

print( "\n1+1 = ", 1+1 )

print( "\n-1+1 = ", -1+1 )

print( "\n1-1 = ", 1-1 )

print( "\n2*1 = ", 2*1 )

print( "\n100/10 = ", 100/10 )

print( "\n100>5 = ", 100>5 )

print( "\n100<5 = ", 100<5 )

print( "\n100>=5 ->", 100>=5 )

print( "\n100<=5 ->", 100<=5 )

print( "\n100>=100 ->", 100>=100 )

print( "\n100<=100 ->", 100<=100 )

print( "\n0xaa&0xf0 = %x", 0xaa&0xf0 )

print( "\n0xaa|0x55 = %x", 0xaa|0x55 )

print( "\nresult=5 = ", result=5 )

print( "\n100!=5 = ", 100!=5 )

print( "\n100==5 = ", 100==5 )

result = 100

print( "\nresult = ", result, " result+=5 = ", result+=5 )

print( "\nresult = ", result, " result-=5 = ", result-=5 )

print( "\nresult = ", result, " result*=5 = ", result*=5 )

print( "\nresult = ", result, " result/=5 = ", result/=5 )

print( "\nresult = %x", result, " result&=5 = %x", result&=5 )

parma = 100

parmb = 5

print( "\n", parma,"+", parmb," = ", parma+parmb )

print( "\n", parma,"-", parmb," = ", parma-parmb )

print( "\n", parma,"*", parmb," = ", parma*parmb )

print( "\n", parma,"/", parmb," = ", parma/parmb )

print( "\n", parma,">", parmb," = ", parma>parmb )

print( "\n", parma,"<", parmb," = ", parma<parmb )

print( "\n %x", parma,"& %x", parmb," = %x", parma&parmb )

print( "\n %x", parma,"| %x", parmb," = %x", parma|parmb )

print( "\n", parma,"==", parmb," = ", parma==parmb )

print( "\n", parma,"!=", parmb," = ", parma!=parmb )

print( "\n", parma,"+=", parmb," = ", parma+=parmb )

print( "\n", parma,"-=", parmb," = ", parma-=parmb )

print( "\n", parma,"*=", parmb," = ", parma*=parmb )

print( "\n", parma,"/=", parmb," = ", parma/=parmb )

print( "\n %x", parma,"&= %x", parmb," = %x", parma&=parmb )

print( "\n %x", parma,"|= %x", parmb," = %x", parma|=parmb )

print( "\n", parma,"=", parmb," = ", parma=parmb )

print( "\n 100>5&&100>5 = ", 100>5&&100>5 );

print( "\n 100>5&&100<5 = ", 100>5&&100<5 )

print( "\n 100<5&&100>5 = ", 100<5&&100>5 );

print( "\n 100>5||100>5 = ", 100>5||100>5 );

print( "\n 100>5||100<5 = ", 100>5||100<5 )

print( "\n 100<5||100>5 = ", 100<5||100>5 )

print( "\n 100<5||100<5 = ", 100<5||100<5 );

print( "\n 0x400>>8 = %x", 0x400>>8 )

print( "\n 0x400<<8 = %x", 0x400<<8 )


 

Operators   && ||

 

 


Description:

&&  logical and               100>5&&100>5 = 1

                              100>5&&100<5 = 0

||  logical or                100>5||100>5 = 1

                              100>5||100<5 = 1

100<5||100<5 = 0

 

Parameters:  None

 

Example:

global( parma )

global( parmb )

global( result )

result = 4

print( "\nresult = %x", result, " result|=5 = %x", result|=5 )

print( "\n1+1 = ", 1+1 )

print( "\n-1+1 = ", -1+1 )

print( "\n1-1 = ", 1-1 )

print( "\n2*1 = ", 2*1 )

print( "\n100/10 = ", 100/10 )

print( "\n100>5 = ", 100>5 )

print( "\n100<5 = ", 100<5 )

print( "\n100>=5 ->", 100>=5 )

print( "\n100<=5 ->", 100<=5 )

print( "\n100>=100 ->", 100>=100 )

print( "\n100<=100 ->", 100<=100 )

print( "\n0xaa&0xf0 = %x", 0xaa&0xf0 )

print( "\n0xaa|0x55 = %x", 0xaa|0x55 )

print( "\nresult=5 = ", result=5 )

print( "\n100!=5 = ", 100!=5 )

print( "\n100==5 = ", 100==5 )

result = 100

print( "\nresult = ", result, " result+=5 = ", result+=5 )

print( "\nresult = ", result, " result-=5 = ", result-=5 )

print( "\nresult = ", result, " result*=5 = ", result*=5 )

print( "\nresult = ", result, " result/=5 = ", result/=5 )

print( "\nresult = %x", result, " result&=5 = %x", result&=5 )

parma = 100

parmb = 5

print( "\n", parma,"+", parmb," = ", parma+parmb )

print( "\n", parma,"-", parmb," = ", parma-parmb )

print( "\n", parma,"*", parmb," = ", parma*parmb )

print( "\n", parma,"/", parmb," = ", parma/parmb )

print( "\n", parma,">", parmb," = ", parma>parmb )

print( "\n", parma,"<", parmb," = ", parma<parmb )

print( "\n %x", parma,"& %x", parmb," = %x", parma&parmb )

print( "\n %x", parma,"| %x", parmb," = %x", parma|parmb )

print( "\n", parma,"==", parmb," = ", parma==parmb )

print( "\n", parma,"!=", parmb," = ", parma!=parmb )

print( "\n", parma,"+=", parmb," = ", parma+=parmb )

print( "\n", parma,"-=", parmb," = ", parma-=parmb )

print( "\n", parma,"*=", parmb," = ", parma*=parmb )

print( "\n", parma,"/=", parmb," = ", parma/=parmb )

print( "\n %x", parma,"&= %x", parmb," = %x", parma&=parmb )

print( "\n %x", parma,"|= %x", parmb," = %x", parma|=parmb )

print( "\n", parma,"=", parmb," = ", parma=parmb )

print( "\n 100>5&&100>5 = ", 100>5&&100>5 );

print( "\n 100>5&&100<5 = ", 100>5&&100<5 )

print( "\n 100<5&&100>5 = ", 100<5&&100>5 );

print( "\n 100>5||100>5 = ", 100>5||100>5 );

print( "\n 100>5||100<5 = ", 100>5||100<5 )

print( "\n 100<5||100>5 = ", 100<5||100>5 )

print( "\n 100<5||100<5 = ", 100<5||100<5 );

print( "\n 0x400>>8 = %x", 0x400>>8 )

print( "\n 0x400<<8 = %x", 0x400<<8 )

 


Operators   >> <<

 

 


Description:

>>  shift right               0x100>>4 = 0x010

<<  shift left                0x010<<4 = 0x100

 

Parameters:  None

 

Example:

 

global( myvariable )

global( state )

 

print( "\nExample using >> and << shift operators" )

state = 0

myvariable = 0x40000000

while(1)

      print( "\nmyvariable = %x", myvariable )

      if( state == 0 ); myvariable=myvariable>>1;endif()

      if( state == 1 ); myvariable=myvariable<<1;endif()

      if( myvariable == 0 && state == 1 ); myvariable = 0x40000000; state = 0; endif()

      if( myvariable == 0 && state == 0 ); myvariable = 0x00000001; state = 1; endif()

      delay( 500 )

wend()


 

Operator Example - Results

 

Version: Alpha 0x00000602 built on Aug 30 2009 at 12:59:42

result = 4 result|=5 = 5

1+1 = 2

-1+1 = 0

1-1 = 0

2*1 = 2

100/10 = 10

100>5 = 1

100<5 = 0

100>=5 ->1

100<=5 ->0

100>=100 ->1

100<=100 ->1

0xaa&0xf0 = a0

0xaa|0x55 = ff

result=5 = 5

100!=5 = 1

100==5 = 0

result = 100 result+=5 = 105

result = 105 result-=5 = 100

result = 100 result*=5 = 500

result = 500 result/=5 = 100

result = 64 result&=5 = 4

100+5 = 105

100-5 = 95

100*5 = 500

100/5 = 20

100>5 = 1

100<5 = 0

 64& 5 = 4

 64| 5 = 65

100==5 = 0

100!=5 = 1

100+=5 = 105

105-=5 = 100

100*=5 = 500

500/=5 = 100

 64&= 5 = 4

 4|= 5 = 5

5=5 = 5

 100>5&&100>5 = 1

 100>5&&100<5 = 0

 100<5&&100>5 = 0

 100>5||100>5 = 1

 100>5||100<5 = 1

 100<5||100>5 = 1

 100<5||100<5 = 0

 0x400>>8 = 4

 0x400<<8 = 40000

semicolon test

result = 10

result = 9

result = 8

result = 7

result = 6

result = 5

result = 4

result = 3

result = 2

result = 1

DONE WITH TEST OPERATORS

 

DONE

 

 

print( "string", expression, "string %x", expression )

 

 


Description: Outputs a formatted string of characters to the

             console. Variable data can be displayed in both

             decimal and hexadecimal formats. Supports

             C like ‘\n’ for newline.

 

Parameters:  “” – anything surrounded by paranthesis is

             displayed on the console ( with the exception

             of a %x ). Anything not surrounded by “” is assumed

             to be an expression. Normally, expression results

             are displayed as decimal values.  The %s formatter

can be used to display  expressions in hexadecimal.

 

Example:

 

global( myvariable ); myvariable = 12345678

print( “\nDisplay variable as decimal on newline ”, myvariable )

print( “\nDisplay variable as hexadecimal on newline %x”, myvariable )

print( “\n100/5=”, 100/5, “\n4*9=”, 4*9, “ -> no newline” ) 

global( parma )

global( parmb )

parma = 100; parmb = 5

print( "\n", parma,"+", parmb," = ", parma+parmb )

print( "\n", parma,"-", parmb," = ", parma-parmb )

print( "\n", parma,"*", parmb," = ", parma*parmb )

print( "\n", parma,"/", parmb," = ", parma/parmb )

print( "\n", parma,">", parmb," = ", parma>parmb )

print( "\n %x", parma,"& %x", parmb," = %x", parma&parmb )

print( "\n", parma,"==", parmb," = ", parma==parmb )

print( "\n", parma,"!=", parmb," = ", parma!=parmb )

print( "\n", parma,"+=", parmb," = ", parma+=parmb )

print( "\n", parma,"/=", parmb," = ", parma/=parmb )

print( "\n %x", parma,"&= %x", parmb," = %x", parma&=parmb )

print( "\n", parma,"=", parmb," = ", parma=parmb )

print( "\n 100>5&&100>5 = ", 100>5&&100>5 );

print( "\n 100>5||100>5 = ", 100>5||100>5 );

print( "\n 0x400>>8 = %x", 0x400>>8 )

print( "\n 0x400<<8 = %x", 0x400<<8 )

 

delay( number of ms )

 

Description: Delays for the specified number of milliseconds.

             There are 1000ms in a second.

             Note:    While waiting in a delay, the interpreter

                      cannot process interrupts or debug

                      commands. 

 

Parameters:  Number of milliseconds to delay.

 

Returns:     None

 

Example:

 

global( myvariable ); myvariable = 5000

delay( 1000 )                                              // delay 1 second

print( "\nDisplay variable as decimal on newline ", myvariable )

delay( myvariable )                                  // delay 5000 seconds

print( "\nDisplay variable as hexadecimal on newline %x", myvariable )

delay( myvariable + 1000 )                    // delay 6000 seconds

print( "\nGot here after myvariable + 1000 delay" )


 

int version()

 


Description: Displays the version number and build date/time

             of the interpreter.

 

Parameters:  None

 

Returns:     Returns the interpreter version as a integer.

 

Example:

 

print( "\n\n\n\nInterpreter Version" )

version()

 

 

                     

 


 

 

debug( 0 or 1 )                   

 

 


Description: debug(0) disables debugging completely ( even from

             the IDE ).

             debug(1) enables debugging.

 

Parameters:  None

 

Returns:     None

 

Example:

 

debug(1)                // Enables debugger

 

global( myvariable )

                               

myvariable = 0

print( "\nBit masking example using a while() loop" )

while( myvariable < 0x10 )

 

      breakpoint(1)     // Stop and debug

 

      print( "\nmyvariable = 0x%x", myvariable, " - " )

      if( myvariable & 0x10 ); print( "bit 4 is high," ); endif()

      if( myvariable & 0x08 ); print( "bit 3 is high," ); endif()

      if( myvariable & 0x04 ); print( "bit 2 is high," ); endif()

      if( myvariable & 0x02 ); print( "bit 1 is high," ); endif()

      if( myvariable & 0x01 ); print( "bit 0 is high," ); endif()

      myvariable += 1

wend()

 


 

 

breakpoint( breakpoint # )

 

 


Description: When the interpreter executes this instruction,

             a internal flag is set telling the interpreter

             to go into debug mode before executing the next

             instruction.

 

Parameters:  breakpoint # - currently ignored, but can be

             used as id of breakpoint.

 

Returns:     None

 

Example:

 

debug(1)                // Enables debugger

 

global( myvariable )

                               

myvariable = 0

print( "\nBit masking example using a while() loop" )

while( myvariable < 0x10 )

 

      breakpoint(1)     // Stop and debug

 

      print( "\nmyvariable = 0x%x", myvariable, " - " )

      if( myvariable & 0x10 ); print( "bit 4 is high," ); endif()

      if( myvariable & 0x08 ); print( "bit 3 is high," ); endif()

      if( myvariable & 0x04 ); print( "bit 2 is high," ); endif()

      if( myvariable & 0x02 ); print( "bit 1 is high," ); endif()

      if( myvariable & 0x01 ); print( "bit 0 is high," ); endif()

      myvariable += 1

wend()

 


 

int loaddll( "dll_path_filename.dll" )

 

 


Description: Loads a language Extension DLL.

 

             Language Extension’s are a very powerful feature of

             robotSee.  Using language extensions, users can add

             their own keywords and functionality to RobotSee.

             These additional keywords are integrated into

             the interpreter via a DLL interface.  These

             extension keywords have full access to all

             all variables, and can even create variables.

             The DLL API supports passing parameters and stings.

 

Parameters:  Path / Filename of the DLL

 

Returns:     Returns 0 if DLL failed to load.

 

Example:

 

// load computer vision DLL

loaddll( "bin\RobotSee_ComputerVision_DLL.dll" )

print( "\nComputer Vision DLL version %x", computervision() );

 

soundplay( "WavFiles\welcome.wav" )

 

visionopen(  )

delay(5000)

 

soundplay( "WavFiles\cv_setup.wav" )

 

//----------------------------------------------------------------------------

// Load pre-made Color Tracking filter

//----------------------------------------------------------------------------

print( "\nLoading filter" )

visionfilter( "VisionFilters\ColorTrack.dll" )

visionwrite( pureindex, 50 )  // Set color purity to 50%

 

//----------------------------------------------------------------------------

// Calibrate Red channel to room light, Itterative thresholding

//----------------------------------------------------------------------------

soundplay( "WavFiles\Calibrating.wav" )

print( "\nCalibrating RED to room light" )

print( "\nThis demo uses itterative thresholding." )

print( "\nThis technique is explained in detail at www.emgrobotics.com" )

print( "\ngoto the Computer Vision section." )

visionwrite( colorindex, trackred )

gosub( setthreshold, redthres )

 

 

 

 

 

verbose( level )                         

 


Description: sets interpreter console verbose mode level.

 

Parameters:  The level determines how much verbose information

             is output to the console.

             verbose(0) outputs the least information.

 

Returns:     None

 

Example:

 

 

 

 

 

 

 

 

 


 

soundplay( "filename of sound to play" )

 

 


Description: Play a sound file once ( done in background ).

             The soundplay() keyword returns immediately,

             it does not wait for the sound playback to

             complete. The sound file is played by a separate

             thread in the background.

 

Parameters:  Path and filename for sound file to playback.

             The soundfile can be a mp3, wav, or any other

             soundfile supported by the operating system. 

 

Returns:     None

 

Example:

 

 

// sound test script written by Eric Gregori

//

// soundplay( "filename of sound to play" ) - plays sound once

// soundloop( "filename of sound to play" ) - loops sound

// soundstop( ) - stops current sound playback

 

 

print( "\n\n\n\nInterpreter Version" )

version()

 

soundplay( "WavFiles\welcome.wav" )

 

delay( 5000 )

 

soundloop( "WavFiles\welcome.wav" )

 

delay( 10000 )

 

soundstop()

 

 

 

 

 

 

 

 

 

 

 

 

soundloop( "filename of sound to play" )

 

 


Description: Loop a sound file ( done in background ).

             The soundloop() keyword returns immediately,

             it does not wait for the sound playback to

             complete. The sound file is played by a separate

             thread in the background.

             Use soundstop() to stop the playback.

 

Parameters:  Path and filename for sound file to playback.

             The soundfile can be a mp3, wav, or any other

             soundfile supported by the operating system. 

 

Returns:     None

 

Example:

 

 

// sound test script written by Eric Gregori

//

// soundplay( "filename of sound to play" ) - plays sound once

// soundloop( "filename of sound to play" ) - loops sound

// soundstop( ) - stops current sound playback

 

 

print( "\n\n\n\nInterpreter Version" )

version()

 

soundplay( "WavFiles\welcome.wav" )

 

delay( 5000 )

 

soundloop( "WavFiles\welcome.wav" )

 

delay( 10000 )

 

soundstop()

 

 

 

 

 

 

 

 


 

soundstop( )                        

 

 


Description: Stops soundfile playback immediately.

             Soundstop() does not wait for the sound playback

             to complete.

 

Parameters:  None

 

Returns:     None

 

Example:

 

 

// sound test script written by Eric Gregori

//

// soundplay( "filename of sound to play" ) - plays sound once

// soundloop( "filename of sound to play" ) - loops sound

// soundstop( ) - stops current sound playback

 

 

print( "\n\n\n\nInterpreter Version" )

version()

 

soundplay( "WavFiles\welcome.wav" )

 

delay( 5000 )    // Wait 5 seconds for welcome to finish

 

soundloop( "WavFiles\welcome.wav" )

 

delay( 10000 )   // Wait 10 seconds

 

soundstop()      // Stops the welcome sound file playback

 


 

fileprint( "string", expression, "string %x", expression )

 

 


Description: Works exactly like print(), but outputs data to a

             file instead of the console.  Used to write log

             files, or store data to a file.

             fileopen() must be called before fileprint() is

             used. Fileopen() only needs to be called once.

 

Parameters:  Same as print()

 

Returns:     None

 

Example:

 

 

print( "\nOpening file eric.txt for output" )

fileopen( "Examples\eric.txt" )

 

for( degrees = 0 )

varsin = sin( 100, 1, degrees )

varcos = cos( 100, 1, degrees )

vartan = tan( 100, 1, degrees )

 

varatanto = atanto( 1, 100, varcos, varsin )

fileprint( "\ndegrees=", degrees, " sin=",varsin," cos=", varcos," tan=", vartan," asin=",varasin," acos=", varacos, " atanto = ", varatanto  )

next( degrees += 10, degrees<361 )

 

srand( getms() )

for( degrees = 1 )

varrand = rand( 0, 1000 )

varsqrt = sqrt( 100, varrand )

fileprint( "\nrand = ", varrand, " sqrt( 100, rand ) = ", varsqrt )

next( degrees += 1, degrees<10 )

 

print( "\nClosing file" )

fileclose( )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

fileopen( "filename" )

 

 


Description: Opens a file for writing by fileprint().

             fileopen() must be called before fileprint() is

             used. Fileopen() only needs to be called once.

 

Parameters:  Path and filename of file to write to.

 

Returns:     None

 

Example:

 

 

print( "\nOpening file eric.txt for output" )

fileopen( "Examples\eric.txt" )

 

for( degrees = 0 )

varsin = sin( 100, 1, degrees )

varcos = cos( 100, 1, degrees )

vartan = tan( 100, 1, degrees )

 

varatanto = atanto( 1, 100, varcos, varsin )

fileprint( "\ndegrees=", degrees, " sin=",varsin," cos=", varcos," tan=", vartan," asin=",varasin," acos=", varacos, " atanto = ", varatanto  )

next( degrees += 10, degrees<361 )

 

srand( getms() )

for( degrees = 1 )

varrand = rand( 0, 1000 )

varsqrt = sqrt( 100, varrand )

fileprint( "\nrand = ", varrand, " sqrt( 100, rand ) = ", varsqrt )

next( degrees += 1, degrees<10 )

 

print( "\nClosing file" )

fileclose( )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

fileclose()

 

 


Description: Closes a file opened by fileopen().

 

Parameters:  None

 

Returns:     None

 

Example:

 

 

print( "\nOpening file eric.txt for output" )

fileopen( "Examples\eric.txt" )

 

for( degrees = 0 )

varsin = sin( 100, 1, degrees )

varcos = cos( 100, 1, degrees )

vartan = tan( 100, 1, degrees )

 

varatanto = atanto( 1, 100, varcos, varsin )

fileprint( "\ndegrees=", degrees, " sin=",varsin," cos=", varcos," tan=", vartan," asin=",varasin," acos=", varacos, " atanto = ", varatanto  )

next( degrees += 10, degrees<361 )

 

srand( getms() )

for( degrees = 1 )

varrand = rand( 0, 1000 )

varsqrt = sqrt( 100, varrand )

fileprint( "\nrand = ", varrand, " sqrt( 100, rand ) = ", varsqrt )

next( degrees += 1, degrees<10 )

 

print( "\nClosing file" )

fileclose( )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

int and( int, mask )          

 

 


Description: Closes a file opened by fileopen().

 

Parameters:  None

 

Returns:     None

 

Example:

 

 

- returns variable and mask

 


 

int or( int, mask )              

 

 


Description: Closes a file opened by fileopen().

 

Parameters:  None

 

Returns:     None

 

Example:

 

- returns variable or mask

 

 


 

int rightshift( int, shift )        

 

 


Description: Closes a file opened by fileopen().

 

Parameters:  None

 

Returns:     None

 

Example:

 

 

 

- shifts variable right

 

 


 

int leftshift( int, shift )       

 

 


Description: Closes a file opened by fileopen().

 

Parameters:  None

 

Returns:     None

 

Example:

 

 

 - shifts variable left

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

robot_head_ad4.bmp

 

 

Click Here to Goto www.EMGRobotics.com

Click Here to Goto Robotics and Software blogspot

RobotSee Users Group

Click here to download the RobotVisionToolkit Reference Manual

View on-line RobotVisionToolkit Reference Manual

Download Latest Version of the RobotVisionToolkit with RobotSee - zip