Week 3 - Section 0 - Clap sensing

Site: ΕΛ/ΛΑΚ Moodle
Course: Advanced Coding - June 2017
Book: Week 3 - Section 0 - Clap sensing
Printed by: Guest user
Date: Friday, 19 April 2024, 5:22 PM

Description

In the first week we will learn about the edison robot, its capabilities, sensors and communication with the software. We will also learn how to use the EdWare, the software for programming edison robots.

Chapter 4.1 - Flash LED in response to clap

Write the following program to have the Edison robot flash the left LED in response to a loud sound such as a clap.


In this program the first event wait icon is not being used to wait for time. Instead the program will not continue from this point until a specific event occurs.

Within the first event wait icon’s properties box select the ‘Event happens’ radio button and then select the event type you think is required to respond to a clap.


Chapter 4.2 - Drive in response to a clap

Write the following program to have the Edison robot drive forward in response to a clap.



The Edison robot’s sound sensor is not just sensitive to claps, but can also respond to any loud sound. This includes the robot’s motors, gears and wheels, which also make sound as they turn. To prevent the sound of the robot driving from triggering the sound sensor there are two additional icons used in this program and are marked above with orange stars. The first event wait icon is set to 0.1 seconds and gives the robot’s motors time to stop. The second event wait icon is set to wait for a clap and will allow the program to continue, because it will have detected the sound of the motors.

You will need to use these two icons after stopping the motors if you are using the clap sensor.

Chapter 4.3 - Dance in response to clapping

Using what you have learned in the previous two exercises create a dance routine where the robot responds to your claps.



You will need at least two dance manoeuvres, but you can add as many as you like. The above program has two single action manoeuvres. These two manoeuvers repeat because they are in a loop.

You can also try and add two manoeuvres per clap.