This website uses cookies to ensure you get the best experience on our website.
Ohbot
  • OH
    • Educators
    • Makers
  • About
    • Our Robots
    • Our Story
    • Follow Us
    • Contact
  • Shop
    • All Robots
    • Ohbot Assembled
    • Ohbot Kit
    • Picoh
    • OhbotApp2
    • Accessories
    • Resellers
  • Get Started
    • Ohbot Assembled
    • Ohbot Kit
    • Picoh
    • Accessories
    • Technical Notes
    • Languages
    • Support
  • Learn
    • Picoh
    • Ohbot
    • AI
    • Robot Work
    • Share

⭠
⭢

Lesson 2
​(Key Moves)

Picture
Learning Intention
  • I can program program a robot to move when keys are pressed.

Introduction
How do you control players when playing computer games?  One way is using a computer keyboard with different keys triggering the computer game sprite to carry out different movements such as jumping. We are going to write programs to make Ohbot carry out different sequences of movements when different keys are pressed.
Picture
Let’s make Ohbot nod once whenever the N key is pressed. First we will start with an event instruction.  In the last lesson we used the When green flag clicked event block to start our sequence.  This time we are going to use When___  Key Pressed.  Use the drop down menu to select N as the trigger key. 
​
The scripts will be similar to those created in the previous lesson.  Use 10 and 0 for maximum movements in either direction and 5 to bring Ohbot back to the middle point.  No add a second set of blocks that uses the S key to make Ohbot shake its head.  Select Save As from the File menu and save the program with the name ‘ keyboard N and S’.

Picture
Activity
1. Write a program to make Ohbot’s eyes look up and down when U is pressed and look left and right when L is pressed.

​Extension

Can you write the code to control Ohbot’s lips using the keyboard? T for top lip and B for bottom lip.

Plenary
When we use the keyboard to control Ohbot, Ohbot’s head will continue to move up and down as long as the N (for nod) key is being pressed.  Consequently, if you press N again and again Ohbot will nod again and again.  However, in programming this is not the most efficient way to get a robot to perform an instruction multiple times.  Have a look around in the Ohbot instructions to see if you can find a more efficient way to perform movements again and again?
 
We need to use the repeat instruction from the Control palette.  In the next lesson we will learn to write code using repeat.
​
Picture
OH
Educators
Makers

About
Our Story
Follow Us
Consultancy
Contact
Shop
All Robots
Ohbot Assembled
Ohbot Kit
Picoh
OhbotApp2
Accessories
Resellers
Get Started
​Ohbot Kit
Ohbot Assembled
Picoh
Accessories
Technical Notes

Languages
Support

Learn
Picoh

Ohbot
AI
Robot Work
Share
Picture
Picture
Picture
Picture
Picture
​Ohbot Ltd. 2A Halliday's Mill, London Road, Chalford, Gloucestershire, GL6 8NR, UK
Copyright © Ohbot Ltd.  All rights reserved.
​Ohbot
® is a registered trademark of Ohbot Ltd.
  • OH
    • Educators
    • Makers
  • About
    • Our Robots
    • Our Story
    • Follow Us
    • Contact
  • Shop
    • All Robots
    • Ohbot Assembled
    • Ohbot Kit
    • Picoh
    • OhbotApp2
    • Accessories
    • Resellers
  • Get Started
    • Ohbot Assembled
    • Ohbot Kit
    • Picoh
    • Accessories
    • Technical Notes
    • Languages
    • Support
  • Learn
    • Picoh
    • Ohbot
    • AI
    • Robot Work
    • Share