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

Post on 05-Jan-2016

218 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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.

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

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.

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.

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.

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

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

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.

top related