|
80 | 80 | | grammer should be able to read many languages |
81 | 81 | p(v-if="step >= 3") May only be able to write few languages efficiently |
82 | 82 | p(v-if="step >= 4") But once you know one, others come easier (just like if you learned Latin) |
83 | | - slide(:steps=7, enter="fadeInDown", leave="fadeOutDown") |
| 83 | + slide(:steps=13, enter="fadeInDown", leave="fadeOutDown") |
84 | 84 | h2 Kotlin |
85 | 85 | .center |
86 | | - p(v-if="step >= 2") Very easy to read and teach |
87 | | - p(v-if="step >= 3") It is an Object Oriented Language (most commonly used languages are) |
88 | | - p(v-if="step >= 4") Runs against JRE (which means our robot can run it) |
89 | | - p(v-if="step >= 5") Can import Java (required as that is what WPI Library is written in) |
90 | | - p(v-if="step >= 6") A lot of build time checks |
91 | | - p(v-if="step >= 7") Becoming Android's standard language |
92 | | - //- TODO(WD): Show example snippet of code |
93 | | - slide(:steps=6, enter="fadeInUp", leave="fadeOutUp") |
| 86 | + eg-transition(leave="bounceOutLeft") |
| 87 | + .subslide(v-if="step >= 2 && step <= 7") |
| 88 | + p(v-if="step >= 2") Very easy to read and teach |
| 89 | + p(v-if="step >= 3") It is an Object Oriented Language (most commonly used languages are) |
| 90 | + p(v-if="step >= 4") Runs against JRE (which means our robot can run it) |
| 91 | + p(v-if="step >= 5") Can import Java (required as that is what WPI Library is written in) |
| 92 | + p(v-if="step >= 6") A lot of build time checks |
| 93 | + p(v-if="step >= 7") Becoming Android's standard language |
| 94 | + eg-transition(enter="bounceInRight", leave="bounceOutLeft") |
| 95 | + .subslide(v-if="step >= 8") |
| 96 | + eg-code-block(lang="kotlin"). |
| 97 | + override fun autonomousInit() { |
| 98 | + val input = autoChooser.selected <eg-code-comment :active="step >= 9" enter="fadeInRight"> Get what side our robot is on.</eg-code-comment> |
| 99 | + val side = DriverStation.getInstance().gameSpecificMessage.toCharArray() <eg-code-comment :active="step >= 10" enter="fadeInRight"> Get what side is ours.</eg-code-comment> |
| 100 | + if(input == StartingPosition.LEFT && side[0] == 'L'){ |
| 101 | + Offensive().start() <eg-code-comment :active="step >= 11" enter="fadeInRight"> If robot is on left and our side is lit.</eg-code-comment> |
| 102 | + } else if(input == StartingPosition.RIGHT && side[0]== 'R'){ |
| 103 | + Offensive().start() <eg-code-comment :active="step >=12" enter="fadeInRight"> If robot is on right and our side is lit.</eg-code-comment> |
| 104 | + } else { |
| 105 | + Defensive().start() <eg-code-comment :active="step >= 13" enter="fadeInRight"> Anything else (middle position, left but our side is not lit).</eg-code-comment> |
| 106 | + } |
| 107 | + } |
| 108 | + |
| 109 | + slide(:steps=14, enter="fadeInUp", leave="fadeOutUp") |
94 | 110 | h2 C++ (Arduino) |
95 | 111 | .center |
96 | | - p(v-if="step >= 2") A lot of games and programs are written in C++ |
97 | | - p(v-if="step >= 3") Very low level language |
98 | | - p(v-if="step >= 4") Harder to read but not difficult |
99 | | - p(v-if="step >= 5") Creates some of the fastest binaries |
100 | | - p(v-if="step >= 6") This is what the Arduino "reads" when it runs |
101 | | - //- TODO(WD): Show example snippet of code |
| 112 | + eg-transition(leave="bounceOutLeft") |
| 113 | + .subslide(v-if="step >=2 && step <=6") |
| 114 | + p(v-if="step >= 2") A lot of games and programs are written in C++ |
| 115 | + p(v-if="step >= 3") Very low level language |
| 116 | + p(v-if="step >= 4") Harder to read but not difficult |
| 117 | + p(v-if="step >= 5") Creates some of the fastest binaries |
| 118 | + p(v-if="step >= 6") This is what the Arduino "reads" when it runs |
| 119 | + eg-transition(enter="bounceInRight", leave="bounceOutLeft") |
| 120 | + .subslide(v-if="step >= 7") |
| 121 | + eg-code-block(lang="cpp"). |
| 122 | + int HCSR04::distance(float speedOfSound) |
| 123 | + { |
| 124 | + unsigned long maxTime = (_maxTol * 2) / speedOfSound; <eg-code-comment :active="step >= 8" enter="fadeInRight"> Max time to listen for ping.</eg-code-comment> |
| 125 | + int iteration = 0; |
| 126 | + LOOP: |
| 127 | + iteration++; |
| 128 | + if (iteration > _retries) |
| 129 | + { |
| 130 | + return _badValue; <eg-code-comment :active="step >= 9" enter="fadeInRight"> If we tried too many times, return a bad value (-1).</eg-code-comment> |
| 131 | + } |
| 132 | + unsigned long duration = _echoInMicroseconds(maxTime); <eg-code-comment :active="step >= 10" enter="fadeInRight"> Ping and listen.</eg-code-comment> |
| 133 | + int distance = (duration * speedOfSound / 2); <eg-code-comment :active="step >= 11" enter="fadeInRight"> Caclulate distance.</eg-code-comment> |
| 134 | + if (distance < _minTol || distance > _maxTol) |
| 135 | + { |
| 136 | + if (_retry){ |
| 137 | + delayMicroseconds(10); |
| 138 | + goto LOOP; <eg-code-comment :active="step >= 12" enter="fadeInRight"> Try again if not within tolerance.</eg-code-comment> |
| 139 | + }else{ |
| 140 | + return _badValue; <eg-code-comment :active="step >= 13" enter="fadeInRight"> Return bad value if we don't want to retry.</eg-code-comment> |
| 141 | + } |
| 142 | + } |
| 143 | + return distance; <eg-code-comment :active="step >= 14" enter="fadeInRight"> Return distance if we think it is a good reading.</eg-code-comment> |
| 144 | + } |
| 145 | + |
102 | 146 | slide |
103 | 147 | h3 null reference is not set to an instance of an object |
104 | 148 | p.center: small Things I am still working on |
105 | 149 | .quarter |
106 | 150 | ul |
107 | | - li Code Snippets |
108 | 151 | li Sensors |
109 | 152 | ul |
110 | 153 | li Thermometers |
|
0 commit comments