diff --git a/Custom-FTC-Blocks-(myBlocks).md b/Custom-FTC-Blocks-(myBlocks).md index 6ef38f5..70a65a3 100644 --- a/Custom-FTC-Blocks-(myBlocks).md +++ b/Custom-FTC-Blocks-(myBlocks).md @@ -19,7 +19,7 @@ Hats off to Google engineer [Liz Looney](https://github.com/lizlooney) for this - This tutorial builds myBlocks with [OnBot Java](https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/OnBot-Java-Tutorial), a programming tool running on the Control Hub or Robot Controller (RC) phone. Students already using [Android Studio](https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Android-Studio-Tutorial) can easily follow the same programming. - This tutorial does not teach [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) or OnBot Java (OBJ), beyond the bare minimum needed for basic myBlocks. -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Simple Example: create myGreeting @@ -87,7 +87,7 @@ That's it for the Java! Click the wrench icon to **_Build Everything_** includi > Note: this tutorial intends for you to **manually type** the Java code above. OnBot Java helps by suggesting some code as you type, and by entering import statements when classes are used. Android Studio helps even more. If you require pre-typed text of this example, click [here](https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/SampleOpModes/Custom-FTC-Blocks-(myBlocks)/SampleMyBlocks_v00.java). -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Simple Example: run myGreeting @@ -125,7 +125,7 @@ In the **```key```** socket, type **A greeting for you**. At the **```text```** This tutorial has three more sections with myBlocks guidelines, followed by **six examples** for you to re-type in OnBot Java and test in Blocks. Enjoy! -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Annotation Details @@ -187,7 +187,7 @@ Notice that a default text value could be a suggested real parameter, or an **in Again, the annotation ```@ExportToBlocks``` **must** appear immediately before each myBlock method, even if not using the optional fields. -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# More about Parameter Types @@ -213,7 +213,7 @@ Some final notes about **parameter types**: - For method parameters declared as ```byte```, ```java.lang.Byte```, ```short```, ```java.lang.Short```, ```int```, ```java.lang.Integer```, ```long```, or ```java.lang.Long```, the myBlock will accept any input Block that returns a number and will round that value to the nearest whole number. - If your myBlock method uses a parameter with only **one text character**, you may use (instead of type ```String```) type ```char``` or ```java.lang.Character```. In that case, the myBlock's input socket will accept any Block that returns text and will use **only the first character** in the text string. -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Editing a myBlock @@ -240,7 +240,7 @@ This tutorial has covered these basic requirements so far: The rest of this tutorial gives **examples** that you can **re-type in OnBot Java** and **test in Blocks**. Try making changes and adding features! -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Hardware Example: control a servo @@ -287,7 +287,7 @@ A **different version** (gamepad-controlled, fully commented) of the above Java The final ```.sleep``` Block allows any telemetry to remain visible on the DS screen, before this sample OpMode ends. -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Driving Example @@ -311,7 +311,7 @@ As programmer, you could modify this example in many ways, such as: - the second and third parameters could be **'hard-coded'** into the myBlock, if they will never change - those 2 variables could be initialized in a **non-myBlock method** and used by multiple myBlock methods in that same Java class -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Timer Example @@ -358,7 +358,7 @@ Again, the comment field is the only way to communicate with future users of you > Note: this tutorial intends for you to **manually type** the Java code above. OnBot Java helps by suggesting some code as you type, and by entering import statements when classes are used. Android Studio helps even more. If you require pre-typed text of this example, click [here](https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/SampleOpModes/Custom-FTC-Blocks-(myBlocks)/SampleMyBlocks_v03.java). The linked copy includes more Java comments, omitted above to focus on the Java code. Also not shown are the package and import statements. -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Example: non-myBlock methods @@ -391,7 +391,7 @@ Here are the Robot A and Robot B myBlocks, each with its **comment** balloon and > Note: this tutorial intends for you to **manually type** the Java code above. If you require pre-typed text of this example, click [here](https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/SampleOpModes/Custom-FTC-Blocks-(myBlocks)/SampleMyBlocks_v04.java). The linked copy includes a proper/full amount of Java commenting, omitted above to focus on the Java code. Also not shown are the package and import statements. -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Example: Read-Write File Access @@ -427,7 +427,7 @@ Instead, read the file once and store the relevant data in a variable or array. The same suggestion might apply to reading sensors and encoders, if the data are not changing and are needed only once. -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Example: Modify Telemetry Settings @@ -447,7 +447,7 @@ Here's the Java code for the method only: Want to verify this actually works? Another, slightly more advanced myBlock allows measuring the time between Telemetry updates; it's posted [here](https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/SampleOpModes/Custom-FTC-Blocks-(myBlocks)/W_myBlocks_Telemetry_v02.java). That myBlock can be used in a Blocks program like [this](https://github.com/FIRST-Tech-Challenge/WikiSupport/blob/master/SampleOpModes/Custom-FTC-Blocks-(myBlocks)/W_Telemetry_myBlocks_v02.blk); download the raw **.blk file** and click the **Upload Op Mode** button at the main Blocks menu. Read all comments and instructions. -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Ideas for Other myBlocks @@ -475,7 +475,7 @@ Here are some tips for efficiency, from the developer Liz Looney: - Limit the number of parameters. If your myBlock needs certain information that won't change during the OpMode, use an **initialize method** that's called once at the start of the OpMode. The initialize method stores that information, to avoid repeatedly passing the same parameter each time the myBlock is called. -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
# Summary: Benefits of myBlocks @@ -491,7 +491,7 @@ Here are some tips for efficiency, from the developer Liz Looney: . -[
Return to Top](#introduction)
+
[[Return to Top|https://github.com/FIRST-Tech-Challenge/FtcRobotController/wiki/Custom-FTC-Blocks-(myBlocks)]]
Questions, comments and corrections to westsiderobotics@verizon.net