You are on page 1of 27

the process of writing, testing, debugging/troubleshooting, the source code. Giving knowledge or intelligence to the robot.

Giving task to the robot to fulfill.

So, today you are going to become a second Bill Gates.

GUI is a graphical programming development environment that allows beginner or intermediate programmer and students create their program.

Diagram above is the programming language that we are going to learn today ( Robolab 2.9.3)

NXT

RCX

Software Programming: Main Language


Software Programming:

Robolab 2.9.3 Lego Mindstorm NXT Next Byte Codes & Not eXactly C RobotC NXTGCC

Robolab 2.9.3 and other version only Next Byte Codes RobotC C++ Java

Third Party language


Third Party language


Infra-Red Receiver Input Port - Sensors

On/Off Button Run Program View Program -Switch program Output Port - Responding devices

USB programming port.

3 Output Port - Responding devices (A,B,C)

On/Off Button, Enter. Switch to left Switch to left Exit/ Left program 4 Input Port - Sensors (1,2,3,4)

1. Desktop Computer or Laptop 2. Software ( Robolab any version) 3. Infra-red transmitter programming port or NXT programming port 4. RCX or NXT Brain Controller

1. Turn on your RCX. select Run button to download Firmware. 2. Download the Firmware. This process will take approximately 2 or 3 minutes. Do not disturb the processor while loading. 3. After the Firmware has been loaded, wait a couple seconds after you hear the beeps before you pick it up. 4. Turn the processor off and on again. Your screen should look like below.

Before Firmware

After Firmware

Firmware is a microcode contents of a writable control store (a specialized small area of RAM memory), which defined and implemented the machine instruction set of a processor. Example: - Windows Xp. - Windows Vista.

Download firmware, testing communication, settings

Creating New projects

Quit/ Exiting program

Investigating and collecting data

Basic and simple program for guiding.

Creating New Project Inventor 1 Inventor 2 Inventor 3 Inventor 4 ( Note: The higher the inventor level that you choose, the more commands or function will be given.)

Stop Program Run Program download program into brain Changing Font Size and style

Select, Position, Size

Operate Value Edit Text Connect Wire Scroll Window

Colour

Get Colour

Basic Outputs

Always start an Inventor program with this command.

Always end an Inventor program with this command. Each task will need its own end command.

Use this if you have a motor connected to port A, B, or C that will be spinning in the forward or reverse direction. Use the power level modifier to change how fast the motor spins, from 1 (slow) to 5 (fast). Without a modifier, the power level will be 5 (fast )

Lamp A

Lamp B

Lamp C

Use this if you want the lamps connected to port A, B, or C to turn on. Use the power level modifier to change it from bright (5) to dim (1). Without a modifier, the power level will be 5 (bright).

Stop A

Stop B

Stop C

Stop all Outputs

Use this to stop the motor or lamp connected to ports A, B, and C by braking (abrupt stop).

Play Sound

Use this command to get an audio response from the RCX. Change sounds using the sound type modifier. This modifier must be an integer from 1 to 6. Each represents a preprogrammed sound. 1: Key-click, 2: Beep Beep, 3: Descending Sweep, 4: Rising Sweep, 5: Buzz, 6: Fast Rising Sweep.

Float Outputs Example

Use this command if you want motors to come to a more gradual stop. This command will simply stop powering the motors. Use the ports modifier to float specific ports. Without a modifier, this command will float all ports

This piece of code would turn on motors A and B in the forward direction for two seconds and then stop both motors.

Do you know how to program a car to go straight, turn left and turn right ?? Output C Motor on your right hand side

Output A Motor on your left hand side

Motor A and C move forward [reaction: ( the car go straight)]

Motor A move forward while motor C stop [reaction: ( the car turn right )]

Motor A stop while motor C move forward [reaction: ( the car turn left)]

Motor A and C move backward [reaction: ( the car reverse)

Motor A move forward while motor C move backward [reaction: ( the car turn 360 moving to right)]

Motor A move backward while motor C move forward [reaction: ( the car turn 360 moving to left)]

Wait For's timer

Wait for 1 , 2, 4, 6, 10 seconds

Wait for n hundredths of a second

Wait for n thousandths of a second

Use these icons if you want to wait for the specified amount of time before moving on to the next command. Useful to choose duration of motor and lamp activity.

Wait For's Sensor

Wait for Push

Use this icon to wait for something to push in the touch sensor before moving on to the next command.

Wait for Let Go

Use this icon to wait for something to release the touch sensor before moving on to the next command. If the touch sensor is not pressed to begin with, the touch sensor must be pressed then released.

Use this icon to wait for the light reading to become greater than a certain value before moving on to the next command Wait for Light

Input Port (x)

Value This piece of code turns on Motor A, then waits for the light sensor on Port 1 to read a value greater than 36. Then, it turns off the motor.

Wait for Dark

Use this icon to wait for the light reading to become less than a certain value before moving on to the next command.

Input Port (x)

Value This piece of code turns on motor A, then waits for the light sensor to read a value less than 30. Then, it turns off the motor.

You might also like