vl.4.86 SOFTWARE FOR THE ZERO 2 ROBOT ON BBC COMPUTERS ---------------------------------------------- Enclosed is a disc for the BBC computer that contains a series of programs enabling you to use your Zero 2 robot. These programs cover some simple routines that we have written for your enjoyment and education to those needed to link into the various "brands" of LOGO available. In the first instance this will be for Logotron LOGO only. To boot the disc to access our demonstration software type CHAIN "MENU". You will then see a screen menu with five options available. These are : 1) A list generator and processor; 2) A joystick control program; 3) A self test program; 4) A demonstration of the line follower; and 5) Some simple BASIC routines. These are described in more detail below. LOGO is accessed using the auto-boot command SHIFT-BREAK. This will automatically load Logotron LOGO and all the routines needed to run the robot. You will not need all of these for most uses and it is possible to create new files including just those routines necessary. You will then be presented with a number of questions allowing accuracy etc to be adjusted. Finally, there are some programs for running the robot in BASIC. To load these type PAGE &2200 then *LOAD ZERO then LOAD "ZEROBAS". You can now type in your BASIC program, using the procedures and functions in the ZEROBAS file. All these functions are described in Appendix 4 of the manual. DEMO programs ------------- 1. LISTC is a list creating program. It is convenient and easy to use in which you can get Zero 2 to do most things without needing to know BASIC, LOGO or machine code. There are two menus and you can alternate between them by pressing the spacebar. The entry menu is the first one you come to. Type in a series of instructions such as F 100 (this will move the robot forward 100mm). and so on. The program will make a list of them. Pressing the spacebar will change to the second menu giving a series of commands which operate on the list created. You can choose to eXecute the list, any number of times; Edit the list (only the variable not the command); Save or List the list or even Delete it. It is also possible to Reload a list from disc or cassette. Pressing the space bar returns to the entry menu. If you want Zero 2 to move as the list is built up press the 'I' key to put the program into immediate mode. Now Zero 2 will move as you hold the keys down (only one at a time!) and at the same time clock up the distance moved or number of degrees turned. In this way it is possible to drive Zero 2 round in any pattern and then play it back again, perhaps having edited it in the meantime. It is possible to 'tweak' Zero 2 so that it moves exactly 100mm, say, or turns exactly 90 degrees. To do this select the program constants option on menu 2. You will then be asked whether you want to change the angle or distance constant. This can then be adjusted easily to account for any innacuracies in the robot or drawing surface. A simple calculation is all that is required. So if the robot moved 91 degrees instead of 90 degrees replace the constant shown with a new one which is 90/91 the value of the old one. The same goes for the distance constant. You may need to do this a few times if you want a high degree of accuracy. The constant should be noted as it will need to be changed everytime the program is loaded as the default value is chosen to be the average needed. If you want to set the height of the pen holder without affecting the list press the 'H' key while in immediate mode. This is necessary as the computer does not know whether the clip unit is up or down; it has to be set initially. If you want to alter the speed that Zero 2 moves use the cursor up or down keys. The speed is shown on the screen. Maximum speed is about 208, depending on the surface. If set too high the robot will stall. A joystick can be used instead of the keyboard, or in combination, (in Immediate mode only), provided it was plugged in when the program was first run. The fire button controls pen up and pen down. The latest versions of this file also allow you to use a Concept keyboard attached to the user port. Experiment with the keyboard to find out the areas allocate to RT, LT, BK, FD, PU and PD. These may be slightly different for some types of keyboard. When you execute the list you can run it Backwards or have it repeated any number of times. A convenience is provided when using the Repeat function, so that the pen is not going up and down all the time. If you have a penup/pendown command at the beginning and end of a list of commands, when you set it to repeat the list several times the program will ignore those pen movements except at the actual beginning and actual end of the sequence. 2. JOYSTIK allows you to control the robot from a joystick. You can set a fast speed (maximum about 80). It responds more quickly than the list generation program. No list is built up. 3. STEST is a BASIC program which takes Zero 2 through a series of self test commands. The screen indicates what should be happening. If you have difficulty with making Zero 2 work run this routine to see if all is OK. (It was written by a 12 year old so it is not to be taken as a model of programming style! However this does show you how easy it is to program Zero 2!) 4. LINEMAN is a BASIC program that lets Zero 2 follow a line. This is written in BASIC so that you can see how it works and change the program to investigate the line follower. A machine code program would clearly be faster but not so much fun! Place Zero 2 on a black line 1 to 2 cm wide on a white background. As the manual says optically black may not be infra red black so you may have to choose pens carefully. When the space bar is pressed the robot will start to follow the line showing its movements on the screen. To stop it press 'escape1 or 'break'. You can experiment with the sharpness of turns that Zero 2 makes by following the instructions on the screen. If all sensors see black then the 'black line' message will appear. If no line is seen then this message appears. Similarly if the middle sensor sees white and the two outer ones see black a 'hole in line' message is given. LOGO ---- There are many different types of LOGO for the BBC. However the robot driver routines are loaded, Zero 2 responds to our procedures in the same way. Some of the more important procedures are listed below. The full list is given in the instruction manual. The first question asks you if you want to use a known set of factors to adjust the accuracy of the robot. If you do not a small series of measurements will set the accuracy for your particular usage. (See ADJUST for further details). Once the adjustment has been made you can save the parameters for future use. Typing BEGIN allows the robot to accept your commands and procedures. SETPEN will allow the pen to be set in the uppermost position. The routines most often used are as follows; 1. ADJUST. This allows you to adjust the accuracy of the drawing. Just follow the instructions. It is a recursive procedure so it may be necessary to do this four or five times. The factors given can be stored or noted down and .DEPOSITed into the appropriate locations whenever LOGO is booted up again. The openeing routines, if used, do this automatically. It may be necessary to repeat the ADJUST procedure once every two or three hours if the robot is being used constantly, or if the pen, speed or surface is changed. 2. SETSPD. This sets the speed of the robot. 255 is the highest 1 the lowest. 200 is the recommended value for most use. Print SPD will tell you the present speed setting. 3. SETSCAL. This sets the scale; again 255 is maximum. 1 the minimum. It is easier to use UNITS. Print SCAL will tellyou the present scale setting. 4. UNITS. Allows the drawing distance to be set ie UNITS "mm will make one unit of the screen turtle draw 1mm using Zero 2. UNITS "cm and UNITS "ins will do likewise. 5. SETHORN. This sets the horn frequency. SETHORN 1 will toggle the low tone, SETHORN 2 the high. SETHORN 3 will swap and SETHORN 0 turn them off. 6. SETLEDS. Similar to SETHORN. SETLEDS 1 will toggle the left LED, SETLEDS 2 the right, SETLEDS 3 will swap and SETLEDS 0 turn them off. 7. SETPEN. This is needed to set the pen in the uppermost position so that when a PENUP has been carried out the pen is at the correct point. This is called automatically from the opening routine. 8. USRCALL. This calls up the machine code routines as listed in the manual. USRCALL n will call routine n assuming that the appropriate value has been .DEPOSITed into the appropriate location as shown below. The .EXAMINE procedure is used to see the contents of these locations.