Documente Academic
Documente Profesional
Documente Cultură
GPIO
Mdulo mediante el cual el robot es capaz de interactuar con el entorno en el cual se encuentra instalado.
Funcin output
Description Sets the single specified output channel to the specified state. The Boolean parameter bypass is optional. If set TRUE the execution of the output command bypasses the online motion queue. Syntax output( int channel, int state [, boolean bypass] ) Parameters channel the GPIO channel: an int. Channels 1 to 16 correspond to actual GPIO output points; channels 17 to 24 are virtual outputs that act exactly like real outputs but do not connect to a phyical signal. By watching virtual outputs, a process can synchronize itself to the motion queue. state the state: an int, one of 0 -> off or 1 -> on bypass True (1) -> execution bypasses the online queue and is not synchronized to robot motion False (0) -> output execution is queued in the motion queue. This is the default if this argument is omitted. Returns Success >= 0 Failure < 0 Example output(0, 0) ;; Turns off output 0 command is queued in the online
;; Turns on output 0 independent of the online motion ;; Turns off output 1 queued in the online motion
Funcin input
Description Queries the specified input channel for its state. Returns the state. This subprogram is a function, not a command as it was in the earliest versions of RAPL-3. Syntax int input( int channel ) Parameters channel the input channel: an int Returns Success >= 0 the state, an int, one of: 0 = off 1 = on Failure < 0 Returns error code Example 1 state = input(4) Example 2 if (input(8)) then ;; check sensor for presence of material load_part() ;; material present else continue ;; material not present end if
Salidas [outputs] Se pueden activar y desactivar las salidas utilizando la siguiente funcion: output (canal, estado) Donde canal es una de las 16 salidas. estado es el estado de la salida que se desea, ya sea 1 o 0. 1 = Pone en alto la salida. 0 = Pone en bajo la salida.
Ejemplo: main loop output (1,0) ready() if input(1) == 0 printf( Presionar Boton Verde \n) delay(1000) end if if input(1) == 1 printf( Entrada 1 esta activa \n) output (1,1) delay(3000) end if end loop end main
Arrays.
Un array es una coleccin de datos de objetos donde todos son del mismo tipo de datos y todos usan el mismo identificador, pero cada uno tiene un nico ndice subscrito. Sintaxis
base_type[subscript_list] identifier
donde base_type: es el tipo de dato de cada elemento, subscript_list: es la lista de una o mas constantes separadas por coma, que definen la dimensin, y identifier: es el nombre de la variable. El subndice (subscript) debe ser una expresin constante, tal como un simple entero constante. Por lo tanto para poder usar un array, se debe de identificar primero el tipo de dato. Dentro de parntesis cuadrados se indica el tamao del array y el nombre del array. Ejemplo: teachable cloc[4] puntos
Esto nos va a generar un array del tipo cloc, con un tamao de 4 elementos con los nombres puntos. Cuando ensee esas locaciones, se debe de definir cuatro puntos para el array. Numeracin La numeracin comienza en cero. Declaracin int[4]a int[10]a int[20]a Numero de elementos 4 10 20 Numeracin a[0], a[1], a[2], a[3] a[0], a[1], a[2], a[3], ..., a[7], a[8], a[9] a[0], a[1], a[2], a[3], ..., a[17], a[18], a[19]
Ejemplo: