25
Programming – Remote Control Statements Intro to Robotics

Programming – Remote Control Statements Intro to Robotics

Embed Size (px)

Citation preview

Page 1: Programming – Remote Control Statements Intro to Robotics

Programming – Remote Control Statements

Intro to Robotics

Page 2: Programming – Remote Control Statements Intro to Robotics

Radio Control Setup

Page 3: Programming – Remote Control Statements Intro to Robotics
Page 4: Programming – Remote Control Statements Intro to Robotics
Page 5: Programming – Remote Control Statements Intro to Robotics
Page 6: Programming – Remote Control Statements Intro to Robotics
Page 7: Programming – Remote Control Statements Intro to Robotics

At this point we have supplied the power value at the time the program is written. But, now that we want the robot to respond to real-time commands from the transmitter, a pre-typed value WILL NOT WORK!

Instead, the motor power needs to be set based on a live value set from the transmitter.

Page 8: Programming – Remote Control Statements Intro to Robotics

The joystick’s vertical position is measured by a device called a POTENTIOMOTOR. The signal is translated into a value from 127 to -127, with 0 being the neutral central position.

Page 9: Programming – Remote Control Statements Intro to Robotics
Page 10: Programming – Remote Control Statements Intro to Robotics
Page 11: Programming – Remote Control Statements Intro to Robotics
Page 12: Programming – Remote Control Statements Intro to Robotics
Page 13: Programming – Remote Control Statements Intro to Robotics
Page 14: Programming – Remote Control Statements Intro to Robotics

What happens when you start the code?

Page 15: Programming – Remote Control Statements Intro to Robotics
Page 16: Programming – Remote Control Statements Intro to Robotics
Page 17: Programming – Remote Control Statements Intro to Robotics

The while( ) loopYour robot has the ability to respond to the transmitter

input only ONCE. In order to maintain continued control, the motors need to continue being updated with values from the transmitter.

Page 18: Programming – Remote Control Statements Intro to Robotics

while ( )When the program reaches most commands, it runs

them and then moves on. When the program reaches a while ( ) loop, however, it steps INSIDE the loop, and stays there as long as the while ( ) loops decides that it should. The commands repeat over and over.

Page 19: Programming – Remote Control Statements Intro to Robotics
Page 20: Programming – Remote Control Statements Intro to Robotics
Page 21: Programming – Remote Control Statements Intro to Robotics
Page 22: Programming – Remote Control Statements Intro to Robotics
Page 23: Programming – Remote Control Statements Intro to Robotics
Page 24: Programming – Remote Control Statements Intro to Robotics
Page 25: Programming – Remote Control Statements Intro to Robotics

Test the robot’s movement using the radio transmitter.

TRY THIS!

What happens?