It works. But I didn't do it the way they said to. #yolo
Fork of GradientSolver by
main.cpp@6:53ea00c03b22, 2014-06-06 (annotated)
- Committer:
- mmpeter
- Date:
- Fri Jun 06 07:59:31 2014 +0000
- Revision:
- 6:53ea00c03b22
- Parent:
- 5:87cbce6dc969
Cheater code for the win
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mmpeter | 0:6b067dcbab9d | 1 | #include "mbed.h" |
mmpeter | 0:6b067dcbab9d | 2 | #include "m3pi_ng.h" |
mmpeter | 0:6b067dcbab9d | 3 | #include "cmath" |
mmpeter | 0:6b067dcbab9d | 4 | #include "iostream" |
mmpeter | 0:6b067dcbab9d | 5 | #include <string> |
mmpeter | 0:6b067dcbab9d | 6 | |
mmpeter | 0:6b067dcbab9d | 7 | m3pi thinggy; |
mmpeter | 0:6b067dcbab9d | 8 | |
mmpeter | 0:6b067dcbab9d | 9 | void turn_right(); |
mmpeter | 1:48163ae9fe4d | 10 | void turn_left(); |
mmpeter | 1:48163ae9fe4d | 11 | void victors(); |
mmpeter | 0:6b067dcbab9d | 12 | int v1=0,v2=0,v3=0,v4=0,v5=0,v6=0; |
mmpeter | 0:6b067dcbab9d | 13 | bool found; |
mmpeter | 0:6b067dcbab9d | 14 | int x; |
mmpeter | 0:6b067dcbab9d | 15 | |
mmpeter | 0:6b067dcbab9d | 16 | |
mmpeter | 0:6b067dcbab9d | 17 | using namespace std; |
mmpeter | 0:6b067dcbab9d | 18 | int sensor[5]; |
mmpeter | 0:6b067dcbab9d | 19 | |
mmpeter | 0:6b067dcbab9d | 20 | int main() { |
mmpeter | 1:48163ae9fe4d | 21 | thinggy.raw_sensor(sensor); |
mmpeter | 0:6b067dcbab9d | 22 | while(1){ |
mmpeter | 1:48163ae9fe4d | 23 | |
mmpeter | 0:6b067dcbab9d | 24 | while(found!=1){ |
mmpeter | 1:48163ae9fe4d | 25 | //Reading on north |
mmpeter | 1:48163ae9fe4d | 26 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 27 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 28 | thinggy.printf("1: "); |
mmpeter | 1:48163ae9fe4d | 29 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 30 | v1=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 31 | thinggy.stop(); |
mmpeter | 6:53ea00c03b22 | 32 | //wait(0.01); |
mmpeter | 1:48163ae9fe4d | 33 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 34 | |
mmpeter | 1:48163ae9fe4d | 35 | //Turn 60 degrees from north |
mmpeter | 0:6b067dcbab9d | 36 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 37 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 38 | thinggy.printf("2: "); |
mmpeter | 1:48163ae9fe4d | 39 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 40 | v2=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 41 | thinggy.stop(); |
mmpeter | 6:53ea00c03b22 | 42 | //wait(0.01); |
mmpeter | 1:48163ae9fe4d | 43 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 44 | |
mmpeter | 1:48163ae9fe4d | 45 | //120 degrees from north |
mmpeter | 0:6b067dcbab9d | 46 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 47 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 48 | thinggy.printf("3: "); |
mmpeter | 1:48163ae9fe4d | 49 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 50 | v3=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 51 | thinggy.stop(); |
mmpeter | 6:53ea00c03b22 | 52 | //wait(0.01); |
mmpeter | 1:48163ae9fe4d | 53 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 54 | |
mmpeter | 1:48163ae9fe4d | 55 | //180 degrees from north |
mmpeter | 0:6b067dcbab9d | 56 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 57 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 58 | thinggy.printf("4: "); |
mmpeter | 1:48163ae9fe4d | 59 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 60 | v4=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 61 | thinggy.stop(); |
mmpeter | 6:53ea00c03b22 | 62 | //wait(0.01); |
mmpeter | 1:48163ae9fe4d | 63 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 64 | |
mmpeter | 1:48163ae9fe4d | 65 | //240 degrees from north |
mmpeter | 0:6b067dcbab9d | 66 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 67 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 68 | thinggy.printf("5: "); |
mmpeter | 1:48163ae9fe4d | 69 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 70 | v5=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 71 | thinggy.stop(); |
mmpeter | 6:53ea00c03b22 | 72 | //wait(0.01); |
mmpeter | 1:48163ae9fe4d | 73 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 74 | |
mmpeter | 1:48163ae9fe4d | 75 | //300 degrees from north |
mmpeter | 0:6b067dcbab9d | 76 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 77 | thinggy.raw_sensor(sensor); |
mmpeter | 1:48163ae9fe4d | 78 | thinggy.printf("6: "); |
mmpeter | 1:48163ae9fe4d | 79 | thinggy.printf("%i",sensor[2]); |
mmpeter | 0:6b067dcbab9d | 80 | v6=sensor[2]; |
mmpeter | 0:6b067dcbab9d | 81 | thinggy.stop(); |
mmpeter | 6:53ea00c03b22 | 82 | //wait(0.01); |
mmpeter | 3:b2d61294966e | 83 | turn_right(); |
mmpeter | 3:b2d61294966e | 84 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 85 | |
mmpeter | 6:53ea00c03b22 | 86 | //Chill out |
mmpeter | 6:53ea00c03b22 | 87 | /*thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 88 | thinggy.printf("Relax"); |
mmpeter | 1:48163ae9fe4d | 89 | wait(1); |
mmpeter | 1:48163ae9fe4d | 90 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 91 | thinggy.printf("I got it"); |
mmpeter | 1:48163ae9fe4d | 92 | thinggy.stop(); |
mmpeter | 6:53ea00c03b22 | 93 | wait(1);*/ |
mmpeter | 0:6b067dcbab9d | 94 | |
mmpeter | 0:6b067dcbab9d | 95 | //Determine which direction is darkest |
mmpeter | 5:87cbce6dc969 | 96 | |
mmpeter | 5:87cbce6dc969 | 97 | |
mmpeter | 1:48163ae9fe4d | 98 | //If the darkest spot is found, stop, play victory sound |
mmpeter | 1:48163ae9fe4d | 99 | if(v1==2000){ |
mmpeter | 1:48163ae9fe4d | 100 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 101 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 102 | thinggy.printf("Found it"); |
mmpeter | 5:87cbce6dc969 | 103 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 104 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 105 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 106 | wait(1); |
mmpeter | 1:48163ae9fe4d | 107 | victors(); |
mmpeter | 1:48163ae9fe4d | 108 | return found=1; |
mmpeter | 1:48163ae9fe4d | 109 | } |
mmpeter | 1:48163ae9fe4d | 110 | if(v2==2000){ |
mmpeter | 1:48163ae9fe4d | 111 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 112 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 113 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 114 | turn_right(); |
mmpeter | 5:87cbce6dc969 | 115 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 116 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 117 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 118 | wait(1); |
mmpeter | 1:48163ae9fe4d | 119 | victors(); |
mmpeter | 1:48163ae9fe4d | 120 | return found=1; |
mmpeter | 1:48163ae9fe4d | 121 | } |
mmpeter | 1:48163ae9fe4d | 122 | |
mmpeter | 1:48163ae9fe4d | 123 | if(v3==2000){ |
mmpeter | 1:48163ae9fe4d | 124 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 125 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 126 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 127 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 128 | turn_right(); |
mmpeter | 5:87cbce6dc969 | 129 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 130 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 131 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 132 | wait(1); |
mmpeter | 1:48163ae9fe4d | 133 | victors(); |
mmpeter | 1:48163ae9fe4d | 134 | return found=1; |
mmpeter | 1:48163ae9fe4d | 135 | } |
mmpeter | 1:48163ae9fe4d | 136 | |
mmpeter | 1:48163ae9fe4d | 137 | if(v4==2000){ |
mmpeter | 1:48163ae9fe4d | 138 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 139 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 140 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 141 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 142 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 143 | turn_right(); |
mmpeter | 5:87cbce6dc969 | 144 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 145 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 146 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 147 | wait(1); |
mmpeter | 1:48163ae9fe4d | 148 | victors(); |
mmpeter | 1:48163ae9fe4d | 149 | return found=1; |
mmpeter | 1:48163ae9fe4d | 150 | } |
mmpeter | 1:48163ae9fe4d | 151 | |
mmpeter | 1:48163ae9fe4d | 152 | if(v5==2000){ |
mmpeter | 1:48163ae9fe4d | 153 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 154 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 155 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 156 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 157 | turn_left(); |
mmpeter | 5:87cbce6dc969 | 158 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 159 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 160 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 161 | wait(1); |
mmpeter | 1:48163ae9fe4d | 162 | victors(); |
mmpeter | 1:48163ae9fe4d | 163 | return found=1; |
mmpeter | 1:48163ae9fe4d | 164 | } |
mmpeter | 1:48163ae9fe4d | 165 | |
mmpeter | 1:48163ae9fe4d | 166 | if(v6==2000){ |
mmpeter | 1:48163ae9fe4d | 167 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 168 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 169 | thinggy.printf("Found it"); |
mmpeter | 1:48163ae9fe4d | 170 | turn_left(); |
mmpeter | 5:87cbce6dc969 | 171 | thinggy.forward(0.3); |
mmpeter | 1:48163ae9fe4d | 172 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 173 | thinggy.stop(); |
mmpeter | 1:48163ae9fe4d | 174 | wait(1); |
mmpeter | 1:48163ae9fe4d | 175 | victors(); |
mmpeter | 1:48163ae9fe4d | 176 | return found=1; |
mmpeter | 1:48163ae9fe4d | 177 | } |
mmpeter | 5:87cbce6dc969 | 178 | |
mmpeter | 5:87cbce6dc969 | 179 | |
mmpeter | 1:48163ae9fe4d | 180 | //Continue the search |
mmpeter | 0:6b067dcbab9d | 181 | //North is darkest |
mmpeter | 0:6b067dcbab9d | 182 | if(v1>v2 and v1>v3 and v1>v4 and v1>v5 and v1>v6){ |
mmpeter | 0:6b067dcbab9d | 183 | x=1; |
mmpeter | 0:6b067dcbab9d | 184 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 185 | thinggy.printf("It's 1"); |
mmpeter | 0:6b067dcbab9d | 186 | } |
mmpeter | 0:6b067dcbab9d | 187 | //60 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 188 | else if(v2>v1 and v2>v3 and v2>v4 and v2>v5 and v2>v6){ |
mmpeter | 0:6b067dcbab9d | 189 | x=2; |
mmpeter | 0:6b067dcbab9d | 190 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 191 | thinggy.printf("It's 2"); |
mmpeter | 0:6b067dcbab9d | 192 | } |
mmpeter | 0:6b067dcbab9d | 193 | //120 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 194 | else if(v3>v1 and v3>v2 and v3>v4 and v3>v5 and v3>v6){ |
mmpeter | 0:6b067dcbab9d | 195 | x=3; |
mmpeter | 0:6b067dcbab9d | 196 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 197 | thinggy.printf("It's 3"); |
mmpeter | 0:6b067dcbab9d | 198 | } |
mmpeter | 0:6b067dcbab9d | 199 | //180 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 200 | else if(v4>v1 and v4>v2 and v4>v3 and v4>v5 and v4>v6){ |
mmpeter | 0:6b067dcbab9d | 201 | x=4; |
mmpeter | 0:6b067dcbab9d | 202 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 203 | thinggy.printf("It's 4"); |
mmpeter | 0:6b067dcbab9d | 204 | } |
mmpeter | 0:6b067dcbab9d | 205 | //240 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 206 | else if(v5>v1 and v5>v2 and v5>v3 and v5>v4 and v5>v6){ |
mmpeter | 0:6b067dcbab9d | 207 | x=5; |
mmpeter | 0:6b067dcbab9d | 208 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 209 | thinggy.printf("It's 5"); |
mmpeter | 0:6b067dcbab9d | 210 | } |
mmpeter | 0:6b067dcbab9d | 211 | //300 degrees from north is darkest |
mmpeter | 0:6b067dcbab9d | 212 | else if(v6>v1 and v6>v2 and v6>v3 and v6>v4 and v6>v5){ |
mmpeter | 0:6b067dcbab9d | 213 | x=6; |
mmpeter | 0:6b067dcbab9d | 214 | thinggy.cls(); |
mmpeter | 0:6b067dcbab9d | 215 | thinggy.printf("It's 6"); |
mmpeter | 0:6b067dcbab9d | 216 | } |
mmpeter | 0:6b067dcbab9d | 217 | |
mmpeter | 0:6b067dcbab9d | 218 | switch(x){ |
mmpeter | 0:6b067dcbab9d | 219 | case 1: |
mmpeter | 0:6b067dcbab9d | 220 | //Go forward |
mmpeter | 4:9dd1477111da | 221 | wait(0.1); |
mmpeter | 1:48163ae9fe4d | 222 | thinggy.forward(0.3); |
mmpeter | 4:9dd1477111da | 223 | wait(0.2); |
mmpeter | 0:6b067dcbab9d | 224 | break; |
mmpeter | 0:6b067dcbab9d | 225 | case 2: |
mmpeter | 0:6b067dcbab9d | 226 | //Go 60 degrees from north |
mmpeter | 0:6b067dcbab9d | 227 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 228 | thinggy.forward(0.3); |
mmpeter | 4:9dd1477111da | 229 | wait(0.2); |
mmpeter | 0:6b067dcbab9d | 230 | break; |
mmpeter | 0:6b067dcbab9d | 231 | case 3: |
mmpeter | 0:6b067dcbab9d | 232 | //Go 120 degrees from north |
mmpeter | 0:6b067dcbab9d | 233 | turn_right(); |
mmpeter | 0:6b067dcbab9d | 234 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 235 | thinggy.forward(0.3); |
mmpeter | 4:9dd1477111da | 236 | wait(0.2); |
mmpeter | 0:6b067dcbab9d | 237 | break; |
mmpeter | 0:6b067dcbab9d | 238 | case 4: |
mmpeter | 0:6b067dcbab9d | 239 | //Go 180 degrees from north |
mmpeter | 0:6b067dcbab9d | 240 | turn_right(); |
mmpeter | 0:6b067dcbab9d | 241 | turn_right(); |
mmpeter | 0:6b067dcbab9d | 242 | turn_right(); |
mmpeter | 1:48163ae9fe4d | 243 | thinggy.forward(0.3); |
mmpeter | 4:9dd1477111da | 244 | wait(0.2); |
mmpeter | 0:6b067dcbab9d | 245 | break; |
mmpeter | 0:6b067dcbab9d | 246 | case 5: |
mmpeter | 0:6b067dcbab9d | 247 | //Go 240 degrees from north |
mmpeter | 1:48163ae9fe4d | 248 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 249 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 250 | thinggy.forward(0.3); |
mmpeter | 4:9dd1477111da | 251 | wait(0.2); |
mmpeter | 0:6b067dcbab9d | 252 | break; |
mmpeter | 0:6b067dcbab9d | 253 | case 6: |
mmpeter | 0:6b067dcbab9d | 254 | //Go 300 degrees from north |
mmpeter | 1:48163ae9fe4d | 255 | turn_left(); |
mmpeter | 1:48163ae9fe4d | 256 | thinggy.forward(0.3); |
mmpeter | 4:9dd1477111da | 257 | wait(0.2); |
mmpeter | 0:6b067dcbab9d | 258 | break; |
mmpeter | 6:53ea00c03b22 | 259 | } |
mmpeter | 6:53ea00c03b22 | 260 | } |
mmpeter | 0:6b067dcbab9d | 261 | } |
mmpeter | 6:53ea00c03b22 | 262 | } |
mmpeter | 0:6b067dcbab9d | 263 | |
mmpeter | 6:53ea00c03b22 | 264 | //EFFECTS: turns the robot right 60 degrees |
mmpeter | 0:6b067dcbab9d | 265 | void turn_right(){ |
mmpeter | 0:6b067dcbab9d | 266 | int n=0; |
mmpeter | 0:6b067dcbab9d | 267 | wait(.08); |
mmpeter | 3:b2d61294966e | 268 | while (n<272){ |
mmpeter | 0:6b067dcbab9d | 269 | thinggy.left_motor(0.2); |
mmpeter | 0:6b067dcbab9d | 270 | thinggy.right_motor(-0.2); |
mmpeter | 0:6b067dcbab9d | 271 | n++; |
mmpeter | 0:6b067dcbab9d | 272 | } |
mmpeter | 0:6b067dcbab9d | 273 | wait(0.15); |
mmpeter | 1:48163ae9fe4d | 274 | } |
mmpeter | 6:53ea00c03b22 | 275 | //EFFECTS: turns the robot left 60 degrees |
mmpeter | 1:48163ae9fe4d | 276 | void turn_left(){ |
mmpeter | 1:48163ae9fe4d | 277 | int n=0; |
mmpeter | 1:48163ae9fe4d | 278 | wait(.08); |
mmpeter | 3:b2d61294966e | 279 | while (n<272){ |
mmpeter | 1:48163ae9fe4d | 280 | thinggy.left_motor(-0.2); |
mmpeter | 1:48163ae9fe4d | 281 | thinggy.right_motor(0.2); |
mmpeter | 1:48163ae9fe4d | 282 | n++; |
mmpeter | 1:48163ae9fe4d | 283 | } |
mmpeter | 1:48163ae9fe4d | 284 | wait(0.15); |
mmpeter | 1:48163ae9fe4d | 285 | } |
mmpeter | 1:48163ae9fe4d | 286 | |
mmpeter | 1:48163ae9fe4d | 287 | //EFFECTS: Play victory tune |
mmpeter | 1:48163ae9fe4d | 288 | void victors(){ |
mmpeter | 1:48163ae9fe4d | 289 | // V=volume max is 15::O5=octave5::G16=G16th note::R24=rest24th note...a rest is needed between any two note that are the same |
mmpeter | 1:48163ae9fe4d | 290 | char hail[]={'V','1','0', |
mmpeter | 1:48163ae9fe4d | 291 | //hail to the victors valiant |
mmpeter | 1:48163ae9fe4d | 292 | 'O','5', |
mmpeter | 1:48163ae9fe4d | 293 | 'C','2', |
mmpeter | 1:48163ae9fe4d | 294 | |
mmpeter | 1:48163ae9fe4d | 295 | 'O','4', |
mmpeter | 1:48163ae9fe4d | 296 | 'G','#','4', |
mmpeter | 1:48163ae9fe4d | 297 | 'A','#','4', |
mmpeter | 1:48163ae9fe4d | 298 | |
mmpeter | 1:48163ae9fe4d | 299 | 'O','5', |
mmpeter | 1:48163ae9fe4d | 300 | 'C','4', |
mmpeter | 1:48163ae9fe4d | 301 | |
mmpeter | 1:48163ae9fe4d | 302 | 'O','4', |
mmpeter | 1:48163ae9fe4d | 303 | 'G','#','4', |
mmpeter | 1:48163ae9fe4d | 304 | 'A','#','4', |
mmpeter | 1:48163ae9fe4d | 305 | |
mmpeter | 1:48163ae9fe4d | 306 | 'O','5', |
mmpeter | 1:48163ae9fe4d | 307 | 'C','4', |
mmpeter | 1:48163ae9fe4d | 308 | }; |
mmpeter | 2:49565c1ff0bf | 309 | |
mmpeter | 1:48163ae9fe4d | 310 | //the number of characters in the array |
mmpeter | 1:48163ae9fe4d | 311 | int numb=strlen(hail); |
mmpeter | 1:48163ae9fe4d | 312 | thinggy.playtune(hail,numb); |
mmpeter | 1:48163ae9fe4d | 313 | thinggy.cls(); |
mmpeter | 1:48163ae9fe4d | 314 | thinggy.printf("I win!"); |
mmpeter | 6:53ea00c03b22 | 315 | wait(1); |
mmpeter | 1:48163ae9fe4d | 316 | } |