robolab[1] traducido

Upload: ie31746francisco

Post on 04-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Robolab[1] Traducido

    1/52

    ROBOLAB

  • 7/30/2019 Robolab[1] Traducido

    2/52

    QUE ES EL ROBOLAB?

    Es un lenguaje utilizado para programarlos robots.Fotos, llamados iconos representan

    funciones diferentes para crear la lgicade su programa.Uso de la Torre de infrarrojos se puededescargar los programas que escribenen su RCX.

  • 7/30/2019 Robolab[1] Traducido

    3/52

    Introduccin

    Haga doble clic en

    el acceso directo de

    ROBOLAB para

    iniciar la aplicacin.

  • 7/30/2019 Robolab[1] Traducido

    4/52

    Introduccin

    Haga clic en el

    botn del

    programador

  • 7/30/2019 Robolab[1] Traducido

    5/52

    Introduccin

    Haga doble clic en

    Inventor 4 para que

    aparezca una

    ventana deprograma en blanco.

  • 7/30/2019 Robolab[1] Traducido

    6/52

    Un programa sencillo

    Ahora vamos a escribir un programa

    simple con ROBLAB

    Este programa girara a uno de los

    motores durante 2 segundos y luego se

    apagar.

  • 7/30/2019 Robolab[1] Traducido

    7/52

    Un programa sencillo

    Esta es una ventana de

    programa en blanco.

    La luz verde es el

    comienzo del programa.

    La luz roja es el final del

    programa.

    La paleta de funciones

    contiene todos los

    iconos que tendr queescribir el programa.

    Blank Program Window

    Functions Palette

  • 7/30/2019 Robolab[1] Traducido

    8/52

    Un programa sencillo

    The first icon is the motor.

    Select the icon with the A over

    the motor because the motor is

    connected to Port A.

    The arrow shows what direction

    the motor will run. Choose theone pointing to the right.

    Click the icon and place it in the

    program window. Click again

    over the spot where you want to

    place the icon. For information about each icon,

    click Help, then Show Help.

    Help Window

  • 7/30/2019 Robolab[1] Traducido

    9/52

    Un programa sencillo

    Motors can be

    programmed to run

    at different power

    levels, from1(lowest) to

    5(highest).

  • 7/30/2019 Robolab[1] Traducido

    10/52

    Un programa sencillo

    Iconos del nivel de

    poder se encuentran

    los modificadores de

    los sub-paleta,situada en la paleta

    Functions.

    Haga clic en el

    icono de nivel 5 ycolocarlo debajo del

    motor.

  • 7/30/2019 Robolab[1] Traducido

    11/52

    Un programa sencillo

    A continuacin

    ponemos un retardo

    de tiempo para que

    el motor funcionedurante 2 segundos.

    El icono se puede

    encontrar en la

    paleta de sub-con laimagen de un reloj.

  • 7/30/2019 Robolab[1] Traducido

    12/52

  • 7/30/2019 Robolab[1] Traducido

    13/52

    Un programa sencillo

    Para enlazar todos los

    iconos juntos para

    hacer de la ejecucin

    del programa, ahora

    necesitamos la

    herramienta de

    alambre.

    Seleccione el men de

    Windows, acontinuacin, Mostrar

    paleta de herramientas

  • 7/30/2019 Robolab[1] Traducido

    14/52

    Un programa sencillo

    Here the wire tool

    has been selected

    Wire Tool

  • 7/30/2019 Robolab[1] Traducido

    15/52

  • 7/30/2019 Robolab[1] Traducido

    16/52

    Un programa sencillo

    Dont forget to

    connect the Power

    Level Modifier to the

    motor.

  • 7/30/2019 Robolab[1] Traducido

    17/52

    The RCX

    This is the brain of

    your robot.

    The inputs (sensors)

    are connected toports 1, 2, and 3

    The outputs

    (motors, lamps) areconnected to ports

    A, B, and C

  • 7/30/2019 Robolab[1] Traducido

    18/52

    RCX Buttons

    On-Off turns the RCX onand off. The RCX shutsitself off after 15 minutesunless changed in setup

    Run starts and stops theprogram

    Prgm selects whichprogram you want to run.You can store up to 5 at

    once. View lets you view the

    values at the ports. Thisis useful when looking atsensor values.

  • 7/30/2019 Robolab[1] Traducido

    19/52

    Downloading to the RCX

    Turn on the RCX.

    Select a programnumber to store it.

    Place the InfraRedTower 6 to 8 inchesfrom the RCX.

    Make sure the

    receiver is facing thetower.

    InfraRed Tower

  • 7/30/2019 Robolab[1] Traducido

    20/52

    Downloading

    Select Run from theOperate menu.

    This starts

    downloading theprogram.

    The RCX will makea rising sweep

    sound if thedownload wassuccessful.

  • 7/30/2019 Robolab[1] Traducido

    21/52

    Problems when downloading

    If any of the icons

    are not connected

    properly you will see

    an error listdescribing what the

    problem is.

  • 7/30/2019 Robolab[1] Traducido

    22/52

    If you get an error

    Make sure the InfraRedTowers serial cable isconnected to thecomputer.

    Make sure the RCX ison.

    Try moving the RCXcloser to the tower.

    Check the batteries (9Vin tower and 6 AA inRCX).

  • 7/30/2019 Robolab[1] Traducido

    23/52

    Other Tools

    The Select tool letsyou select icons so

    you can move them

    or delete them. The Text tool lets

    you put text in the

    program window.

    Select

    Text

  • 7/30/2019 Robolab[1] Traducido

    24/52

    Other Tools

    The replace tool lets

    you replace an icon

    without rewiring.

    Replace Tool

  • 7/30/2019 Robolab[1] Traducido

    25/52

    Using the replace tool

    Lets replace the 2 second delay with an 8

    second delay.

  • 7/30/2019 Robolab[1] Traducido

    26/52

    Using the replace tool

    Select the replace

    tool and left click the

    2 second display

    icon. Select replace from

    the menu and a new

    functions palette

    should appear.

    New Functions Palette

    Replace

  • 7/30/2019 Robolab[1] Traducido

    27/52

    Using the replace tool

    Select the 8 second

    delay from the

    palette.

    8 secondDelay

  • 7/30/2019 Robolab[1] Traducido

    28/52

    Using the replace tool

    The program has now been changed from a 2

    second delay to an 8 second delay.

  • 7/30/2019 Robolab[1] Traducido

    29/52

    Loops

    Loops allow you to

    repeat part of the

    program so you

    dont have to rewritethe same part over.

    These are the icons

    beginning and end

    of a loop.

  • 7/30/2019 Robolab[1] Traducido

    30/52

    Loops

    You can specify thenumber of times youwant the loop torepeat with a textbox modifier.

    You can also usethe random dice

    modifier to have theloop repeat arandom number oftimes.

  • 7/30/2019 Robolab[1] Traducido

    31/52

    Jumps

    These are the jumpand land icons

    You can have more

    than one jump perprogram.

    Keep them separateby assigning a

    number or using adifferent color foreach.

  • 7/30/2019 Robolab[1] Traducido

    32/52

    Examples using loops and jumps

    Here are some examples of a program

    that tells the RCX to beep every

    second.

    The first 2 are examples of finite loops.

    The 3rd implements an infinite loop.

  • 7/30/2019 Robolab[1] Traducido

    33/52

    Example 1

    This program beeps every second.

    It does this for 10 loops.

  • 7/30/2019 Robolab[1] Traducido

    34/52

    Example 2

    This program beeps every second.

    It does this for a random number of loops.

  • 7/30/2019 Robolab[1] Traducido

    35/52

    Example 3

    This program beeps every second.

    It does this forever.

  • 7/30/2019 Robolab[1] Traducido

    36/52

    The Touch Sensor

    Remember to specify

    the port that the sensor

    is connected to.

    The sensors are usually

    used to control motors

    and lights.

    The fork allows the

    program to run based

    on the position of thesensor.

    Wait until

    pressed

    Wait until

    released

    Touch

    Sensor

    Fork

  • 7/30/2019 Robolab[1] Traducido

    37/52

  • 7/30/2019 Robolab[1] Traducido

    38/52

    The Light Sensor

    These are used to

    detect light levels

    between 0 and 100.

    The top icon waits until

    the level is above the

    given value of 50.

    The bottom icon waits

    until the level is below

    the given value of 50.

  • 7/30/2019 Robolab[1] Traducido

    39/52

    The Light Sensor

    The top icon waits until

    the light level is a

    certain percentage

    above the current level.

    The bottom waits untilthe light level is a

    certain percentage

    below the current level.

    In both cases, thepercentage is 5%.

  • 7/30/2019 Robolab[1] Traducido

    40/52

    Timers

    There are 3 timers.

    The program can wait

    for a certain amount of

    time.

    1 sec = 10 timer counts.

    Make sure you reset the

    timer at the beginning of

    your program.

  • 7/30/2019 Robolab[1] Traducido

    41/52

    Example using a timer

    This program times how long it takes for

    someone to push in a touch sensor.

    If the sensor is pressed within 3

    seconds of starting the program a

    descending sweep sound will be played.

    If more than 3 seconds pass a different

    rising sweep sound will be played.

  • 7/30/2019 Robolab[1] Traducido

    42/52

    Timer Example

    Reset the red timer.

    Wait for touch sensor to be pressed.

    Play appropriate sound based on the time

    elapsed.

  • 7/30/2019 Robolab[1] Traducido

    43/52

    Containers

    Another word for

    container is variable.

    Variables are a number

    you dont know until you

    run the program.

    Can have up to 3.

    You can zero a

    container, give it a

    number, or give it the

    value of a sensor.

  • 7/30/2019 Robolab[1] Traducido

    44/52

    Container Math Operations

    Add 4 to

    the

    container

    value.

    Multiply

    container

    value by 2.

    Subtract 3

    from the

    container

    value.

    Divide

    container

    value by 1.

  • 7/30/2019 Robolab[1] Traducido

    45/52

    Containers

    You can use the

    value of a container

    to set the power

    level for an outputsuch as a light or

    motor.

    Container Value

  • 7/30/2019 Robolab[1] Traducido

    46/52

    Example using a container

    This program starts out with the power

    level of the motor at 0.

    Every time the sensor is pressed the

    power level increases by 1.

    When the sensor has been pressed 6

    time the motor shuts off.

  • 7/30/2019 Robolab[1] Traducido

    47/52

  • 7/30/2019 Robolab[1] Traducido

    48/52

    Multiple Tasks

    This allows your

    program to do 2 or

    more things at the

    same time. Each task must end

    with a red stoplight.

    You can have up to

    10 separate tasks in

    a program.

  • 7/30/2019 Robolab[1] Traducido

    49/52

    Example using tasks

    This program has 3 tasks.

    The 1st turns on motor A for 45 seconds thenturns it off.

    The 2nd

    plays a rising sweep then waits arandom amount of time before repeatingthis happens 4 times.

    The 3rd turns motor C on for 1 second then

    turns it off and waits 2 seconds thishappens a random number of times.

  • 7/30/2019 Robolab[1] Traducido

    50/52

    Task Example

  • 7/30/2019 Robolab[1] Traducido

    51/52

    Debugging

    Even if the program successfully

    downloads to the RCX, the program

    may not work the way you expect it to.

  • 7/30/2019 Robolab[1] Traducido

    52/52

    Debugging Hints

    Have your program play a sound when itreaches a certain point if you hear thesound you know your program got to thatpoint this is especially good for forkdebugging.

    Sounds and lamps are a good way to seethe value of a container.

    Add time delays to slow down the actions ofyour robot so that you have time to thinkabout what is going on.

    Keep trying until your program works the way