Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st...

16
Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009

Transcript of Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st...

Page 1: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Graphical Programming Languages

Lecture 19: Supporting Material

Dr Kathryn Merrick

Thursday 21st May, 2009

Page 2: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.
Page 3: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Overview

Graphical programming languages:

Variables, types, values, operators

Flow of control

Built-in functions

Strengths and limitations

Page 4: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Lego Mindstorms NXT: Programmable Robots

Programmable Brick

Page 5: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

The NXT Programming Environment

The programming window

Page 6: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Built-in Functions

‘Move’ functions connected up like Lego bricks

Input parameters set here

Page 7: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Loops

Loop connected up like a Lego brick Exit condition

(can behave like a for loop or a while loop)

Instructions to be repeated will be dragged into here

Page 8: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Selection

Selection connected up like a Lego brick Conditions

set here

What to do will be dragged into here

Page 9: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

A Complete Program

Page 10: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Demo 1:

Programming a Lego scorpion

Page 11: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Variables

Variable brick

Page 12: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Maths Operators

Maths operator brick

Page 13: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Boolean Operators

Boolean operator brick

Page 14: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Complete Program

Page 15: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Demo 2:

Programming a Lego scorpion

Page 16: Graphical Programming Languages Lecture 19: Supporting Material Dr Kathryn Merrick Thursday 21 st May, 2009.

Summary

After today’s lecture you should be able to:

Identify the key programming tools we used in MATLAB in the NXT graphical language

Appreciate the strengths and weaknesses of graphical languages