Speed Based on Volume Values & Assignment (Part 1)

Similar documents
Line Tracking Basic Lesson

CONTENTS. What is ROBOTC? Section I: The Basics

Additional Guides. TETRIX Getting Started Guide NXT Brick Guide

After: bmotorreflected[port2]= 1; //Flip port2 s direction

C.I. La chaîne d information LES CAPTEURS. Page 1 sur 5

Logging into Citrix (Epic) using an RSA Soft Token - New RSA User

understanding sensors

Updating Your Applied Account

File: C:\Program Files\Robotics Academy\RobotC\sample programs\rcx\arushi\robot_

Downloading a Sample Program over USB

TETRIX Add-On Extensions. Encoder Programming Guide (ROBOTC )

Getting Started Guide: Transaction Download for QuickBooks Windows. Information You ll Need to Get Started

How To Program An Nxt Mindstorms On A Computer Or Tablet Computer

Outlook Data File navigate to the PST file that you want to open, select it and choose OK. The file will now appear as a folder in Outlook.

smarshencrypt User s Guide

SharePoint Wiki Redirect Installation Instruction

ROBOTC Programming Competition Templates

Advanced Programming with LEGO NXT MindStorms

Best Robotics Sample Program Quick Start

Rev. 06 JAN Document Control User Guide: Using Outlook within Skandocs

USER GUIDE. MyNetFone USB VoIP Phone with Soft Phone Software User Guide. Table of Contents

The Social Accelerator Setup Guide

Business mail 1 MS OUTLOOK CONFIGURATION... 2

How to Create Custom Sound Effects for NXT Robots.

How to set up your Secure in Outlook 2010*

Configure Outlook 2013 to connect to Hosted Exchange

ROBOTC Software Inspection Guide with Additional Help Documentation

Dreamweaver and Fireworks MX Integration Brian Hogan

Using the VEX Cortex with ROBOTC

BitLocker To Go User Guide

Distribution List Manager User s Manual

Setting up a basic database in Access 2007

MXL 990 Virtual Preamp Installation

FrontDesk Installation And Configuration

Transferring data safely

Troubleshooting / FAQ

educ Office Remove & create new Outlook profile

USER MANUAL. For. Unlimited Audio Conferencing

USING MS OUTLOOK. Microsoft Outlook

How to use encrypted in the WECI scheme.

USING MS OUTLOOK WITH FUS

Employer Online Access Documentation

To Install EdiView IP camera utility on iphone, follow the following instructions:

SETTING UP REMOTE ACCESS ON EYEMAX PC BASED DVR.

SWCS 4.2 Client Configuration Users Guide Revision /26/2012 Solatech, Inc.

General Tips: Page 1 of 20. By Khaled Elshaer.

Why should I back up my certificate? How do I create a backup copy of my certificate?

How to access Answering Islam if your ISP blocks it

Getting Started Manual

USING OUTLOOK WITH ENTERGROUP. Microsoft Outlook

Section 5: Installing the Print Driver

Driver Updater Manual

AVAYA VOICE OVER INTERNET PROTOCOL (VOIP) TELEPHONE USER MANUAL. Revised by Leeward CC IT October University of Hawaiʻi Community Colleges

Programming LEGO NXT Robots using NXC

Receiver Customization

USER MANUAL. For. Unlimited Conferencing

THIS HAD BETTER BE GOOD

Introduction. Inserting Hyperlinks. PowerPoint 2010 Hyperlinks and Action Buttons. About Hyperlinks. Page 1

INSTRUCTION MANUAL All-In-One GSM Home Alarm System SB-SP7200-GSM

Database manager does something that sounds trivial. It makes it easy to setup a new database for searching with Mascot. It also makes it easy to

DNS Record Information for the Pushex Exchange server

Simple Computer Backup

How to Hold Virtual Office Hours

Microsoft Office Access 2007 Training

Breathe. Relax. Here Are the Most Commonly Asked Questions and Concerns About Setting Up and Programming the SurroundBar 3000.

CEFNS Web Hosting a Guide for CS212

Hosting Users Guide 2011

The Complete Educator s Guide to Using Skype effectively in the classroom

Here are the steps to configure Outlook Express for use with Salmar's Zimbra server. Select "Tools" and then "Accounts from the pull down menu.

How Do I Connect My Mac with Bluetooth Devices?

Lync Online Meeting & Conference Call Guide

EasyC. Programming Tips

Arduino Lesson 1. Blink

Stage One - Applying For an Assent Remote Access Login

Understanding offline files

2/26/2008. Sensors For Robotics. What is sensing? Why do robots need sensors? What is the angle of my arm? internal information

Shopping Cart Software

Using BT MeetMe with Skype for Business Online

Downloading Audiobooks with Overdrive from the Marion Public Library

Altaro Hyper-V Backup - Offsite Backups & Seeding Guide

FC5A Modbus Communication Training

Waves: Recording Sound Waves and Sound Wave Interference (Teacher s Guide)

TFA Laptop Printing - Windows

Page 18. Using Software To Make More Money With Surveys. Visit us on the web at:

Trusted Relationships. Sending Invitations. Sending Invitations from Outlook

idatafax Troubleshooting

Getting Started Guide: Transaction Download for QuickBooks Windows

Installing Basic PAYE Tools onto a networked computer

Connecting to the Staff Desktop Service

IBM TCP/IP Network Port Monitor

Parcelhub - Linnworks Custom Courier Integration Script

SharePoint List Filter Favorites Installation Instruction

Send Individually User s Manual

Configuring your client to connect to your Exchange mailbox

Transcription:

Speed Based on Volume Values & Assignment (Part 1) The Sound Sensor is the last of the standard NXT sensors. In essence it s a kind of microphone which senses amplitude (how loud or soft a sound is), but not anything else about it. The Sound Sensor, like the Light Sensor, reports values from 0-100 which do not correspond to any specific standard scale. Sound Sensor The Sound Sensor has an orange foam pad which resembles a microphone

In this lesson you will learn how to use the Sound Sensor to manipulate your robot s motors 1. Start by opening a new program. 1. Create new program Select File > New to create a blank new program. 2. Open the Motors and Sensors Setup menu to configure the Sound Sensor. 2. Open Motors and Sensors Setup Select Robot > Motors and Sensors Setup to open the Motors and Sensors Setup menu.

3. Configure the sensor on port 1 to be a SoundDB sensor named soundsensor. 3a. Name the sensor Name the Sound Sensor on port S1 soundsensor. 3b. Set Sensor Type Identify the Sensor Type as a Sound DB sensor. 3c. Click OK Click the OK button to save your changes. 4. You will be prompted to save the changes you have just made. Press Yes to save. 4. Select Yes Save your program when prompted. 5. Save this program as SoundValue. 5a. Name the program Give this program the name SoundValue. 5b. Save the program Press Save to save the program with the new name.

The Sound Sensor is now configured. Now, start the program by creating a task main() structure, then add a forward movement command for 10 seconds with both motors at 50% power. 1 2 3 4 5 6 task main() motor[motorc] = 50; motor[motorb] = 50; wait1msec(10000); Checkpoint Let s analyze what we re telling the robot to do. The basic motor command sets a given motor s power level. In this case, you re setting Motor C and B s power level to 50. 50 is just a number. If you wanted to set the power to 25, you would put 25 here. 100 works too. Really, any number value will do... The Sound Sensor reading is also a number value. If the Sound Sensor is reading a sound level of 40, SensorValue(soundSensor) is the number value 40! We could simply put SensorValue(soundSensor) in place of the number we ve been using, and the motor power would be set to the Sound Sensor s value! Let s try it. SensorValue(soundSensor) 100 25

6. Motor powers are number values. You can replace any number value with another, like changing a 50 to 75 or 100. SensorValue(soundSensor) is also a number. Replace 50 with the sensor value. 1 2 3 4 5 6 task main() motor[motorc] = SensorValue(soundSensor); motor[motorb] = SensorValue(soundSensor); wait1msec(10000); 6. Modify the code Replace the number values of 50,to the value of the Sound Sensor, S1. Checkpoint. In theory, our program should now work like this: The Sound Sensor reads the amount of sound in the environment The Sound Sensor sets the motor power to be equal to the sensor s numeric value The robot should run at a speed determined by the Sound Sensor reading fast for loud, and slow for quiet

1 7. Save, download, and run your program. Clap your hands to change the sound sensor value. 7a. Make some noise! Run the program then clap your hands to change the sound sensor value. 7b. Observe the (lack of) reaction The robot doesn t seem to do anything different... End of Section The robot s reaction to the level of sound in the environment was pretty disappointing nothing happened. In the next section, we ll take a look at what s going on, where our understanding went wrong, and how the problem can be fixed.

Speed Based on Volume Values & Assignment (Part 2) In this lesson you will make the robot s motors use the Sound Sensor s values in real-time. Try running the robot again, but make the sound just as you press the Start button. Clap and Run This time, clap (or talk into the Sound Sensor) just as you press the Start buton. Observe the behavior The robot moves much faster. The robot is clearly responding to sound levels, but not at the right time. Remember the line tracking behavior? The wait1msec command tells the robot to go to sleep for a period of time. Going to sleep means the robot isn t watching the sound sensor or updating motor values! If we want to keep the motor s power level up to date with the sensor, we will need to make sure that the power level command gets run over and over. We ll need to use a while loop and a Timer. 7

Speed Based on Volume Values and Assignment (Part 2) (cont.) 1. Delete the wait statement, and add a while() loop around the motor behaviors. 1 2 3 4 5 6 7 8 9 task main() while() motor[motorc] = SensorValue(soundSensor); motor[motorb] = SensorValue(soundSensor); wait1msec(10000); 1a. Add this code Place the while loop so that the motor commands go inside its curly braces. The (condition) is not yet specified. 1b. Delete this line We don t want the robot sleeping when it needs to update motor powers. 2. Timers must first be initialized, so add a ClearTimer(T1) just before the loop. Check the timer in our while loop condition, we use timer1[t1] less than 10,000 milliseconds, or 10 seconds. 1 2 3 4 5 6 7 8 9 task main() ClearTimer(T1); while(time1[t1] < 10000) motor[motorc] = SensorValue(soundSensor); motor[motorb] = SensorValue(soundSensor); 2a. Add this code Timers must be reset before use. 2b. Add this code The (condition) will now check whether the timer, T1, is less than 10000ms (10 seconds). The loop s body will run while this is true, i.e. less than 10 seconds have passed since the reset.

Speed Based on Volume Values and Assignment (Part 2) (cont.) 3. Save, download, and run your program. Run the program Run the program and clap your hands repeatedly. Observe the behavior The robot moves depending on how much noise it detects! End of Section The robot is now checking the sensor repeatedly, and updating the motor power with the new sensor values as quickly as it can, over and over again. As a result, the robot is now responsive to new sound levels in the environment. Rather than just on or off, loud or soft, we ve programmed the robot to change the motor power level in direct proportion to the sound level. This is a powerful way to use sensor values. It takes advantage of their numeric nature to link a sensor value with another numeric value, motor power output. In the next Unit s challenges, you ll have additional opportunities to look even more deeply into the nature of numbers and other data types in ROBOTC. For the immediate future, we think you ll find this Volume Based on Speed behavior helpful on the Obstacle Course. See you on the field! 9