real-time data through data hubs. begin by adding a basic move block, 5 rotations 75% power

10
Real-Time Data through Data Hubs

Upload: nickolas-cobb

Post on 05-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

Real-Time Data through

Data Hubs

Page 2: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

Begin by adding a basic Move block, 5 rotations 75% power

Page 3: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

Place a yellow Sound Sensor block from the Sensor Palette before the move block.

The data plug for the sound block should be showing.

Page 4: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

Wire the sound level plug to the power level plug on the Move block.

The sound sensors value will be used as the robots speed.

Make sure the sound sensor is plugged into Port 2.

Download and Run the Program

Page 5: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

The sound sensor blocks reads the sound sensor value, and passes it along to the motor block overriding the motor power value. Then the robot goes for 5 rotations using that value. If the sound value changes while the robot is running the Move block it is not passed on because the sound block is only run at the beginning of the program.

Page 6: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

Restructure the program to use the data

hubs to process live values The yellow sensor block must run more than once so it can continue to feed values to the Move block. The Move block must use the value then return immediately to the sensor block so it can update the sound level.

Page 7: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

To repeat a behavior over and over again a loop is required.

Drag a loop out of the Flow palette. Move both blocks together into the loop.

Page 8: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

Adjust the Move block to run for Unlimited instead of 5 rotations so that the program does not need to wait for the full 5 rotations before checking the Sound sensor data value again.

Set the 5 rotations to Unlimited in the loop: Sensor, Rotation Sensor, Port C, 5 rotations.

Unlimited

Page 9: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

Download & Run. Alternate talking and whispering to the robot as it moves. Does it change speeds?

Page 10: Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power

A-Mazing Talking

Using the sound sensor to control one of the motors speeds program the robot so that you can talk the robot through the maze. Robots begin in the center of the maze.