Updated Writing an Op Mode with FTC Blocks (markdown)
@ -89,7 +89,7 @@ If you did not [create and activate a configuration file yet](https://github.com
|
||||
| 6. Drag the “gamepad1.LeftStickY” block so it snaps in place onto the right side of the “set tgtPower to” block. This set of blocks will continually loop and read the value of gamepad #1’s left joystick (the y position) and set the variable tgtPower to the Y value of the left joystick.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/AddingDCMotorStep6a.jpg" width="300"></p>Note that for the F310 gamepads, the Y value of a joystick ranges from -1, when a joystick is in its topmost position, to +1, when a joystick is in its bottommost position.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/AddingDCMotorStep6bControlHub.jpg" width="250"></p>This means that for the blocks shown in our example, if the left joystick is pushed to the top, the variable tgtPower will have a value of -1. |
|
||||
| 7. Click on the “Math” category for the programming blocks and select the negative symbol (“-“).<p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/AddingDCMotorStep7ControlHub.jpg" width="300"></p> |
|
||||
| 8. Drag the negative symbol (also known as a “negation operator”) to the left of the “gamepad1.LeftStickY” block. It should click in place after the “set tgtPower to” block and before the “gamepad1.LeftStickY” block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/AddingDCMotorStep8ControlHub.jpg" width="300"></p> With this change, the variable tgtPower will be set to +1 if the left joystick is in its topmost position and will be set to -1 if the joystick is in its bottommost position. |
|
||||
| 9. Click on the “Actuators” category of blocks.<p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/AddingDCMotorStep9ControlHub.jpg" width="200"></p> |
|
||||
| 9. Click on the “Actuators” category of blocks. Then click on the "DcMotor" category of blocks. <p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/AddingDCMotorStep9ControlHub.jpg" width="200"></p> |
|
||||
| 10. Select the “set motorTest.Power to 1” programming block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/AddingDCMotorStep10ControlHub.jpg" width="400"></p> |
|
||||
| 11. Drag and place the “set motorTest.Power to 1” block so that it snaps in place right below the “set tgtPower to” block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/AddingDCMotorStep11ControlHub.jpg" width="400"></p> |
|
||||
| 12. Click on the “Variables” block category and select the “tgtPower” block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/AddingDCMotorStep12ControlHub.jpg" width="300"></p> |
|
||||
|
Reference in New Issue
Block a user