0 Bewertungen0% fanden dieses Dokument nützlich (0 Abstimmungen)
868 Ansichten6 Seiten
This document provides a summary of primitives for the MSWLogo programming language. It describes primitives for drawing, writing text, working with files, controllers and inputs/outputs. Key primitives allow drawing shapes and text, loading and saving files, and controlling digital and analog outputs and reading digital and analog inputs for integration with microcontrollers. The document is a user guide for version 6.5a of the MSWLogo language translated into Spanish.
This document provides a summary of primitives for the MSWLogo programming language. It describes primitives for drawing, writing text, working with files, controllers and inputs/outputs. Key primitives allow drawing shapes and text, loading and saving files, and controlling digital and analog outputs and reading digital and analog inputs for integration with microcontrollers. The document is a user guide for version 6.5a of the MSWLogo language translated into Spanish.
Copyright:
Attribution Non-Commercial (BY-NC)
Verfügbare Formate
Als TXT, PDF, TXT herunterladen oder online auf Scribd lesen
This document provides a summary of primitives for the MSWLogo programming language. It describes primitives for drawing, writing text, working with files, controllers and inputs/outputs. Key primitives allow drawing shapes and text, loading and saving files, and controlling digital and analog outputs and reading digital and analog inputs for integration with microcontrollers. The document is a user guide for version 6.5a of the MSWLogo language translated into Spanish.
Copyright:
Attribution Non-Commercial (BY-NC)
Verfügbare Formate
Als TXT, PDF, TXT herunterladen oder online auf Scribd lesen
________ 2 GUIDE ___________________________________________ Introduction 2 Introduction and use of primitives in MSWLogo ______________ 2 4 4 5 6 9 9 1.3 .- List of selected primitive MSWLogo ____________ _________________________ _________ 1.3.1 1.3.2 Primitives for drawing primitives for writing, editing and working with files _________ 1.3.3 Primitives for working with controllers ____ _______________ ____________________________________ 1.3.4 1.3.5 Primitives Prim itive Sound MSWLogo out of 1.4.1.5.1.6.1.7.1.8.1.9.1.10.2 ______________________ ___ Using variables __________________________________ 9 Definition and use of proce dimientos__________________ 10 Comments ________________________________________ __ 11 Save 12 work MSWLogo_________________________ Upload file imágenes_______ ___________________________ ______________________________________ 13 12 Working with windows and buttons Use MSWLogo __________________ 13 REFERENCES ___________________________________________ 14 1 MICROSOFT PRACTICE WINDOWS LOGO 6.5a GUIDE 1.1 .- Introduction The Logo language was created in the 60s by Seymour Papert for children to learn mathematical ideas programming with this language. In the following decades he and his team continued their development and trying to create a program with a g raphical environment that was both powerful and easy to use. In 1994 MSWLogo was modified to allow control by computer via serial and parallel ports. All versio ns of Logo software for Unix operating systems, MS-DOS, Macintosh and Windows de veloped initially by the University of California (Berkeley), are free and can b e copied without any restriction for educational institutions. Logo is the symbo l of a turtle robot that moves under the control of a computer drawing as it mov es across the screen. In some versions of this language the tortoise has evolved into other objects. For example, in MSWLogo has become a triangle. MSWLogo can be used for multiple purposes: to draw, to create sounds, to manipulate a contro ller through the computer, etc. The version I will try to explain in this docume nt is the version that presents the National Center for Education Information an d Communication (IASB), which is a version 6.5a MSWLogo translated into Castilia n. 1.2 .- Introduction and use of primitives in MSWLogo MSWLogo is an interpreted language, ie the orders entered by the user are interp reted by the computer and immediately executed in order. Instead, the programs " compiled" are first converted into machine code before any part of the program t o become operational. MSWLogo screen is divided into two parts: 1. The main scre en. This window is where you draw, load images, etc. 2. The working window or command prompt. The command window is divided into two parts: 2a) The data entry box or primitive. You can use lowercase or uppercase f or primitive because Logo does not distinguish between each other. The primitive s are executed after being introduced to the work window and press the ENTER key or clicking the Run button. 2.b) or primitive list command executed. Each primi tive is recorded in a list of orders and commands of the window above the input. Some abbreviations are primitive and sometimes not, for example, the primitive h as an alias bt borratexto. You can use either one or the other and the result is the same. To exit MSWLogo can follow three paths: 1. Use the early goodbye. 2. Select the Exit option from the File menu. 3. Click on the blade of the window. 1.3 .- List of selected primitive MSWLogo 1.3.1 Primitives drawing STOPS EARLY SHORTCUT AV 200 200 DESCRIPTIO N The turtle moves the specified number of units. The turtle back the specified number of un its. The turtle rotates in the direction of clockwise the number of degrees spec ified. The turtle rotates counter-clockwise the specified angle. Put the pen dow n and the way painted (painting is the normal mode of the turtle to draw). Put t he pen down and how to delete (the turtle is fading through which it moves). Set s the pen up without changing your way. Put the pen down, without changing its m ode. Returns the turtle to the center of the screen without deleting. You must u se the primitive SUBELAPIZ to prevent draw while going toward the center. PONCL [... ... ...] Set color pencil determined according to: PONCOLORLAPIZ [255 milli on] = Red PONCOLORLAPIZ [000 255 000] = Green PONCOLORLAPIZ [000 000 255] = Blue Hides the turtle (the triangle) on the screen. Displays the turtle (the triangl e) on the screen BACK GIRADERECH A 90 150 RE VIRA 90 GD 150 45 90 GI PLA 45 PONLAPIZ GIRAIZQUIERDA GOMA GO SUBELAPIZ SL BAJALAPIZ BL CENTER PONCOLORLAPIZ [... ... ...] MUESTRATORTUGA OCULTATORTUGA MT OT HEAD BORRAPANTALLA [HOLA] BP RO [HOLA] Clears the screen and places the turtle at the center. Type your text in the dir ection the turtle is. Place the pencil across the track and the height specified . MSWLogo uses only the value of the width. PONGROSOR [October 1910] PONG [October 1910] 1.3.2 Primitives for writing, editing and working with files DESCRIPTION Command write s the entry or entries in the output is currently writing (initially the termina l). Command writes the entry or is the subject entries in the output is currentl y writing (initially the terminal). If the input is a list, the outermost bracke ts are not shown, but those of the sublists. Command window opens and allows EDI TATODO editor amends the definitions of the elements (procedures, variables, etc .). Does the same as Ed All button. EDITAPROCEDIMIENTOS Command that opens the e ditor window and allows amends the definitions of procedures. Command to read th e instructions given file and executes them. Command stored in the file given th e definitions of all procedures, variables and property lists uncovered. SHORTCU T EARLY SHOW object WRITE object Edit Content EDIT PROCEDURES LOAD "nombfichero GUARDA" nombfichero 1.3.3 Primitives for working with controllers These primitives are used to working with controllers and CNICE ENCONOR. Keep in mind that these controllers do not have the same number of analog inputs, so we have a primitive that can not be used. In addition, the controller has no analo g outputs CNICE and hence primitive for these outputs can not be used with it. P RIMITIVE TO WORK WITH DIGITAL OUTPUTS DESCRIPTION EARLY Spins in a certain way a motor connected to M1 "D two digital outputs (outputs chosen depend on the cont roller). If the actuator is a lamp, relay or electromagnet, just as active. Rota tes in the opposite direction to the anterior primitive motor M1 "I connected to two digital outputs. Not unlike the previous primitive if other actuators are c onnected (lamp, relay, etc.) Disables the actuator is connected to two outputs M 1 "P digital (to get both outputs are disabled.) Like the previous primitive, al though the actuators M2 "D M2" I, M2 "P are connected to other pairs of digital outputs. M3 "D, M3" I, M3 "P M4" D, M4 "I, M2" P Returns a list with the status of the four engines. Example: M? SAMPLE M? [PDDI] to activate / deactivate all e ngines simultaneously. M: L The parameter: L has to be a list. Example: M [PPID] engines are disabled M1 and M2, M3 is turned to the Left and M4 is rotated to t he right. Enables the actuator in the position indicated in: NUM, CONNECT: NUM w here: NUM 1, 2, 3 or 4. In the case of an engine, it activates to turn left and if it is a lamp, relay or electromagnet, just active. Disable actuators connecte d to the position shown in DISCONNECTED: NUM: NUM. Returns a list of four elemen ts (one for each engine) whose CONNECTED? values are 0 or 1 as they are active o r not. Controlled individually or together each of the eight OUTPUT: NUM digital outputs. Send to the digital outputs the binary number equivalent to decimal we put in: NUM. To activate, for example, exits 1 and 8 will write the command: EX IT 129 Procedures for compatibility with earlier EnviaOcteto: data provided by E NCONOR (has the same function as the primitive OUTPUT). OFF: No OUT? VS? seconds time Controlled individually or together each of the eight digital outputs. Send to t he digital outputs the binary number equivalent to decimal we put in: data. Proc edure for the support provided by ENCONOR primitives. Disconnect the digital out put that is prompted by: n, leaving the rest as they are digital outputs. Return s a list of eight elements with the state of the eight digital outputs (1 if it is ON or 0 when disabled). Returns a decimal number that indicates which digital outputs are enabled. For example,Âif it returns 3 indicates that the digital o utputs 1 and 3 are selected. Or expect a delay of many seconds as we indicate in time. You can use fractions of seconds (eg 0.2). PRIMITIVE TO WORK WITH EARLY DIGITAL INPUTS DESCRIPTION Procedure for compatibil ity with earlier entry: n provided by ENCONOR. Returns TRUE if the indicated dig ital input: n is connected or FALSE otherwise. Returns a decimal number that ind icates which digital inputs VE? are selected. For example, if we execute the ori ginal and it returns 129, 1 and 8 digital inputs have value 1. Returns the value expressed in digital sensor: input (1 SD: Input 2, 3, ..., 8), 1 if the input i s active or 0 otherwise. Returns the status of the eight digital sensors in the form of SD? list (0s or 1s). Leaves the program stopped pending the entry is act ivated EsperaOn: digital input indicated in: entry. Leaves the program stopped a waiting to be turned off EsperaOff: digital input indicated entry: entry. PRIMITIVE TO WORK WITH EARLY ANALOG INPUTS DESCRIPTION Procedure for compatibili ty with earlier leeanalogica: data provided by ENCONOR. Read and write data on p ort needed to get the decimal value (value between 0 and 255) which provides the analog input specified in: data (which may be 1, 2, 3 or 4. If you can read, re turns its value. To get the value in volts corresponding to the decimal value re turned by the primitive is the following formula: Voltage Input (V) = (N º deci mal * 5) / 256 Returns directly in volts of the analog sensor SAV connected to t he analog input 1. Returns directly in volts analog SAW sensor connected to anal og input 2. Returns directly in volts SAX analog sensor connected to analog inpu t 3. Returns directly in volts of analog sensor connected to input SAY analogue 4. Returns directly in volts SAZ analog sensor connected to the analog input 5. returns a list with the value in volts of all sensors SA? analog. PRIMITIVE TO WORK WITH THE DESCRIPTION EARLY ANALOG port Writes the data necessa ry to put in the salidaanalogica: NUM VALUE analog output that tells you in: NUM stress the value indicated in VALUE (varies between 0 and 255). To see the valu e in the output voltage using the following formula: Output Voltage (Volts) = VA LUE / 8.23 Fixed the analog output indicated in: the value VOLTAGE NUM: NUM VALU E voltage specified in VALUE (varies between 0 and 10.5). Returns a list with th e value of all output volt voltage? analog. PRIMITIVE ENVIRONMENT TO WORK IN THE EARLY GRAPHIC DESCRIPTION Create the window s needed to handle the inputs and outputs analog graphics (graphics primitives) and digital and the window to report the status of communication between the com puter and the controller (original reports). Create a window to control the inpu ts and graphical outputs reports analog. Creates a window that reports data for the communication with the port. 1.3.4 DESCRIPTION Primitive Sound emits a sound frequency (Hz) and duration (milliseco nds) indicated. Flujosonido must be a list of pairs [<frequency> <duración>]. I t emits a sound frequency and duration indicated. It emits a sound whose frequen cy matches the parameter passed to it. The sound will continue until APAGASONIDO invoke a command. Remove a sound that has been made with the command ENCIENDESO NIDO. Plays a file type. WAV according to the options indicated. KEY EARLY flujosonido Frequency duration frequency SUENATONO ENCIENDESONIDO SUENAWAVE APAGASONIDO ficherowave options 1.3.5 Early to leave EARLY DESCRIPTION MSWLogo Command Logo leaving, returning control to the operating system. ADIOS 1.4 .- Using variables To assign a value to a variable using the primitive MSWLogo BEAM followed by the name of the variable and the value we want to give the variable. The variable n ame must be preceded by double quotes ("). The syntax is: HAZ "nombVariable valu e For example: HAZ" x 20 HAZ "listacolores [RED YELLOW BLUE] To access the value of a variable must precede the variable name of the colon (:). For example: Sam ple: x HEAD: listacolores 1.5 .- Definition and utilization of To create a procedure MSWLogo must use the reserved word TO followed by the name of the procedure and its parameters (if any).ÂThen put the definition of the p rocedure and this will end with the keyword END. FOR nombprocedimiento [paramete r list] Procedure definition. . FIN procedures to create two options: 1. Use the job window: to display this window must be written on the box or primitive data entry to name [parameter list] and then press ENTER or the Run button. Then will be introduced in this window one by one the sentences that comprise th e procedure and will be pressing the OK button. To finish the definition of the procedure will be introduced early FIN. 2. Using the Edit Window: To access the Edit window will be used primitive EDITATODO or Edit File menu. In addition to d efining procedures in the editing window you can define variables, properties, c omments, etc. When you have finished defining the procedure is saved in the File Save menu item. The following examples will be one by definition procedures. Suppose we want to draw a square in the center of the screen from side to side 100 and another vari able. To do this you must define two procedures: one does not need it and the ot her parameters. The procedure for drawing a square of side 100 is as follows: FO R cuadrado1 borrapantalla center advances 100 advances 100 giraizquierda giraizq uierda 90 90 90 giraizquierda advances 100 advances 100 giraizquierda 90 END The procedure for drawing a square of side variable is as follows: FOR cuadrado2: s ize borrapantalla center repeat 4 [forward: size giraizquierda 90] where the par ameter FIN: size indicates the length of the side of the square you want to draw . After defining the procedures, they can call at any time in a program window o r from the execution of primitive typing its name followed by the required param eters (if the procedure available). There might, for example: cuadrado1 cuadrado 2 150 100 cuadrado2 1.6 .- Comments The comments in MSWLogo are created by putting forward a semicolon (;). For exam ple, THIS IS A COMMENT IN MSWLogo 1.7 .- Save MSWLogo work The options on the File Save or File Save As and save the original "nombfichero let you save a file extension. LGO definitions of all procedures, variables and property lists uncovered. Note that each procedure is not saved in a file, but a ll the work set during a meeting of MSWLogo is saved together in the same file. 1.8 .- Upload file The File menu option Load and load the original "nombfichero allow the loading o f the instructions given file. Importantly, when loading a file is read the inst ructions it contains and executed. In the file selection window to appear only u pload files with a. LGO. To see all the files must be selected in File Type: All Files (*.*). If you have not saved the work environment of the current session to disk file o r if the procedures are already defined in the current session will be overwritt en. But before that MSWLogo issues a warning window: 1.9 .- Working with Images MSWLogo Bitmap menu offers the possibility of working with pictures or drawings: load, save and print. MSWLogo allows the ability to upload images with format. Bmp. To upload an image to this type in the main display must use the Load Bitma p. It also allows you to save images in. Bmp. This menu is used Bitmap Bitmap Sa ve or Save As. 01.10 .- windows and buttons Use MSWLogo With MSWLogo you can create applications and procedures with windows and buttons . This primitive is used as creaventana, creaboton ... Below is an example of an application that consists of several procedures that create a window that has s everal buttons and you can write and delete a string: VentanaEjemplo; procedure that creates the BT window example, delete text display BP clears graphics scree n ocultatortuga creaventana "principal" V_EJEMP [Example of application windows] 120 150 287 100 [] creagroupbox "V_EJEMP" E_Ventana creagroupbox 85 May 0274 "V _EJEMP" E_Escribir February 20 120 50 creaboton "V_EJEMP" Write [WRITE] 25 10 11 0 35 [actualizaestatico "text [Example of windows]] creagroupbox "V_EJEMP" E_Borrar 145 2120 50 creaboton "V_EJEMP" Clear [DELETE] 1 50 10 110 35 [actualizaestatico "text []] creagroupbox" V_EJEMP "E_texto 20 50 1 20 30 creaestatico" V_EJEMP "text [Click a button] 25 60 80 15 creaboton "V_EJEM P" Exit [Exit] 150 60 110 20 [BT BP muestratortuga borraventana "V_EJEMP] END FO R MostrarEjemplo; initial window example let's see an example or leave Sisin sin obox [Display example] [Want to see the example?. ] [VentanaEjemplo] [BT BP] END FOR BorrarVentanaEjemplo borraventana "FIN V_EJEMP 2 REFERENCES â ¢ â ¢ MSWLogo Handbook in English: - ~ jfuller/logotut/logo1.htm http://www.southw est.com.au/ Logo manuals in Spanish: - (The rights of use of this manual we have been expressly granted by its author, Jim Fuller): http://www.southwest.com.au/ ~ jfuller / MSWLogo / spanish.zip - http://www.angeltowns.com/members/mondragon /paradiso/ - sect2