Updated Using Sensors (Blocks) (markdown)

FTC Engineering
2019-04-12 13:48:07 -04:00
parent 599b9fd555
commit effa16809f

@ -33,15 +33,13 @@ Note that it will take an estimated 15 minutes to complete this task.
| ---- |
| 1. Verify that your laptop is still connected to the Robot Controllers Programming Mode Wi-Fi network. |
| 2. Verify that “MyFIRSTOpMode” is opened for editing. If it is not, you can click on the FIRST logo in the upper left hand corner of the browser window on the laptop. This should take you to the main FTC Blocks Development Tool project screen.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep2ControlHub.jpg" width="400"></p>Click on the “MyFIRSTOpMode” project to open it for editing if it is not already opened. |
| 3. If it's not already expanded, click on the “Sensors” category to expand it. If you configured the touch sensor as a digital device, you should see the “Digital Channel” subcategory. Click on “Digital Channel” to display the list of available programming blocks.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep3ControlHub.jpg" width="200"></p> |
| 4. Select the “set digitalTouch.Mode to” block and drag it to the position after the “Put initialization blocks here” comment. By default, this block will set the digital channel named “digitalTouch” to input mode.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep4ControlHub.jpg" width="400"></p> |
| 5. Click on the “Logic” category. Find and click on the “if do else” block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep5.jpg" width="175"></p> |
| 6. Drag the “if do else” block to the position before the “telemetry.update” block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep6.jpg" width="175"></p> |
| 7. Click on the “Other Devices” category to expand it. Click on the “Digital Channel” subcategory, then find and select the “digitalTouch.State” block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep7.jpg" width="175"></p> |
| 8. Drag the “digitalTouch.State” block to the test condition of the “if do else” programming block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep8.jpg" width="300"></p> |
| 9. Click on the “Utilities” category on the left-hand side of your browser. Find and click on the “Telemetry” subcategory.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep9.jpg" width="300"></p>Select the “call telemetry.addData” block (the numeric version) and drag it to the “do” clause of the “if do else” block. |
| 10. Change the “key” value to “digitalTouch” and the “text” value to “NOT pressed (HIGH)”.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep10.jpg" width="300"></p>If the op mode detects that the “digitalTouch” channel is HIGH, it will send a telemetry message indicating that the button is not pressed. |
| 11. Change the “key” value to “digitalTouch” and the “text” value to “NOT pressed (HIGH)”.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep11.jpg" width="400"></p>If the op mode detects that the “digitalTouch” channel is HIGH, it will send a telemetry message indicating that the button is not pressed. |
| 12. Save your op mode and verify that it was saved successfully to the Robot Controller.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep12.jpg" width="400"></p> |
| 13. Follow the procedure outlined in the section titled [Running Your Op Mode](https://github.com/ftctechnh/ftc_app/wiki/Running-Your-Op-Mode) to run your updated op mode.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep13.jpg" width="175"></p>As you run the op mode and push or release the button, the telemetry message on the Driver Station should update to reflect the current state of the digital Touch Sensor. |
| 3. Click on the “Logic” category. Find and click on the “if do else” block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep3ControlHub.jpg" width="175"></p> |
| 4. Drag the “if do else” block to the position before the “telemetry.update” block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep4ControlHub.jpg" width="400"></p> |
| 5. Click on the "Sensors" category to expand it (if it isn't already expanded). Click on the "Touch Sensor" subcategory, then find and select the ".isPressed" block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep5ControlHub.jpg" width="400"></p> |
| 6. Drag the “isPressed” block to the test condition of the “if do else” programming block.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep6ControlHub.jpg" width="300"></p> |
| 7. Click on the “Utilities” category on the left-hand side of your browser. Find and click on the “Telemetry” subcategory.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep7ControlHub.jpg" width="300"></p>Select the “call telemetry.addData” block (the text version) and drag it to the “do” clause of the “if do else” block. |
| 8. Change the “key” value to “testTouch” and the text” value to “is pressed”.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep8ControlHub.jpg" width="300"></p> |
| 9. Insert another "telemetry.addData" block (the text version) to the "else" clause of the "if do else" block. Change the “key” value to “testTouch” and the “text” value to “is NOT pressed”.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep9ControlHub.jpg" width="400"></p> |
| 10. Save your op mode and verify that it was saved successfully to the Robot Controller.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep10ControlHub.jpg" width="400"></p> |
| 11. Follow the procedure outlined in the section titled [Running Your Op Mode](https://github.com/ftctechnh/ftc_app/wiki/Running-Your-Op-Mode) to run your updated op mode.<br/><br/><p align="center"><img src="https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/ftc_app/images/TouchSensorOpModeStep11ControlHub.jpg" width="350"></p>As you run the op mode and push or release the button, the telemetry message on the Driver Station should update to reflect the current state of the digital Touch Sensor. |