Whack a Mole game! Features: - LCD graphics display - Touch pad input - Speaker effects through a class D audio amplifier\ - A high score page maintained by the SD card file system - Analog noise used to seed random numbers

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed

Fork of MPR121_Demo by jim hamblen

Committer:
tpettet3
Date:
Mon Mar 14 16:23:47 2016 +0000
Revision:
8:e6e1e5b3f2a9
Parent:
7:5a8f9a018e1f
Child:
9:867dde4be88a
fully functional

Who changed what in which revision?

UserRevisionLine numberNew contents of line
4180_1 0:e09703934ff4 1 /*
4180_1 0:e09703934ff4 2 Copyright (c) 2011 Anthony Buckton (abuckton [at] blackink [dot} net {dot} au)
4180_1 0:e09703934ff4 3
4180_1 0:e09703934ff4 4 Permission is hereby granted, free of charge, to any person obtaining a copy
4180_1 0:e09703934ff4 5 of this software and associated documentation files (the "Software"), to deal
4180_1 0:e09703934ff4 6 in the Software without restriction, including without limitation the rights
4180_1 0:e09703934ff4 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4180_1 0:e09703934ff4 8 copies of the Software, and to permit persons to whom the Software is
4180_1 0:e09703934ff4 9 furnished to do so, subject to the following conditions:
4180_1 0:e09703934ff4 10
4180_1 0:e09703934ff4 11 The above copyright notice and this permission notice shall be included in
4180_1 0:e09703934ff4 12 all copies or substantial portions of the Software.
4180_1 0:e09703934ff4 13
4180_1 0:e09703934ff4 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4180_1 0:e09703934ff4 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4180_1 0:e09703934ff4 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4180_1 0:e09703934ff4 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4180_1 0:e09703934ff4 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4180_1 0:e09703934ff4 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4180_1 0:e09703934ff4 20 THE SOFTWARE.
4180_1 0:e09703934ff4 21 */
4180_1 0:e09703934ff4 22
4180_1 0:e09703934ff4 23 #include <mbed.h>
4180_1 0:e09703934ff4 24 #include <string>
4180_1 0:e09703934ff4 25 #include <list>
tpettet3 1:89fd0d713ffc 26 #include "uLCD_4DGL.h"
tpettet3 1:89fd0d713ffc 27 #include <mpr121.h>
tpettet3 5:070755be0a77 28 #include "SDFileSystem.h"
tpettet3 5:070755be0a77 29 #include "SongPlayer.h"
tpettet3 1:89fd0d713ffc 30 uLCD_4DGL lcd(p9, p10, p30); // tx, rx, reset
4180_1 0:e09703934ff4 31
4180_1 0:e09703934ff4 32 DigitalOut led1(LED1);
4180_1 0:e09703934ff4 33 DigitalOut led2(LED2);
4180_1 0:e09703934ff4 34 DigitalOut led3(LED3);
4180_1 0:e09703934ff4 35 DigitalOut led4(LED4);
tpettet3 1:89fd0d713ffc 36 AnalogIn Ain(p15);
4180_1 0:e09703934ff4 37
tpettet3 8:e6e1e5b3f2a9 38 //Setup class D audio output on pwm out pin
tpettet3 6:ca03b9c94c88 39 SongPlayer mySpeaker(p21);
tpettet3 8:e6e1e5b3f2a9 40
4180_1 0:e09703934ff4 41 // Create the interrupt receiver object on pin 26
4180_1 0:e09703934ff4 42 InterruptIn interrupt(p26);
tpettet3 8:e6e1e5b3f2a9 43
tpettet3 8:e6e1e5b3f2a9 44 //Setup the Serial to the PC for debugging
4180_1 0:e09703934ff4 45 Serial pc(USBTX, USBRX);
tpettet3 8:e6e1e5b3f2a9 46
tpettet3 8:e6e1e5b3f2a9 47 //setup SD card filesystem
tpettet3 8:e6e1e5b3f2a9 48 SDFileSystem sd(p5, p6, p7, p8, "sd");
tpettet3 8:e6e1e5b3f2a9 49
4180_1 0:e09703934ff4 50 // Setup the i2c bus on pins 28 and 27
tpettet3 1:89fd0d713ffc 51 I2C i2c(p28, p27);
tpettet3 8:e6e1e5b3f2a9 52
tpettet3 8:e6e1e5b3f2a9 53 //setup the note to be played upon hitting a mole
tpettet3 5:070755be0a77 54 float note[1]= {1568.0};
tpettet3 5:070755be0a77 55 float duration[1]= {0.1};
tpettet3 8:e6e1e5b3f2a9 56
tpettet3 8:e6e1e5b3f2a9 57 //initialize the possition integers
tpettet3 1:89fd0d713ffc 58 int pos1;
tpettet3 1:89fd0d713ffc 59 int pos2;
tpettet3 1:89fd0d713ffc 60 int pos3;
tpettet3 1:89fd0d713ffc 61 int pos4;
tpettet3 1:89fd0d713ffc 62 int pos5;
tpettet3 1:89fd0d713ffc 63 int pos6;
tpettet3 8:e6e1e5b3f2a9 64
tpettet3 8:e6e1e5b3f2a9 65 //initialize global variable to keep track of the score
tpettet3 1:89fd0d713ffc 66 int score = 0;
tpettet3 8:e6e1e5b3f2a9 67
tpettet3 8:e6e1e5b3f2a9 68 //create variables for the keypad outputs that correspond to mole possitions
tpettet3 1:89fd0d713ffc 69 int hole1 = 0x100;
tpettet3 1:89fd0d713ffc 70 int hole2 = 0x10;
tpettet3 1:89fd0d713ffc 71 int hole3 = 0x1;
tpettet3 1:89fd0d713ffc 72 int hole4 = 0x200;
tpettet3 1:89fd0d713ffc 73 int hole5 = 0x20;
tpettet3 1:89fd0d713ffc 74 int hole6 = 0x2;
tpettet3 8:e6e1e5b3f2a9 75
tpettet3 8:e6e1e5b3f2a9 76 //create a character buffer to read from the SD card
tpettet3 5:070755be0a77 77 char str [80];
tpettet3 8:e6e1e5b3f2a9 78
4180_1 0:e09703934ff4 79 // Setup the Mpr121:
4180_1 0:e09703934ff4 80 // constructor(i2c object, i2c address of the mpr121)
4180_1 0:e09703934ff4 81 Mpr121 mpr121(&i2c, Mpr121::ADD_VSS);
4180_1 0:e09703934ff4 82
4180_1 0:e09703934ff4 83 void fallInterrupt() {
4180_1 0:e09703934ff4 84 int key_code=0;
4180_1 0:e09703934ff4 85 int i=0;
tpettet3 8:e6e1e5b3f2a9 86
tpettet3 8:e6e1e5b3f2a9 87 //read values from keypad after interupt and bitshift left 8 times
4180_1 0:e09703934ff4 88 int value=mpr121.read(0x00);
4180_1 0:e09703934ff4 89 value +=mpr121.read(0x01)<<8;
tpettet3 8:e6e1e5b3f2a9 90 //Check to see if the a mole is hit after an interupt
tpettet3 3:dbae62823ec8 91 if (value==256&&pos1==1)
tpettet3 3:dbae62823ec8 92 {
tpettet3 6:ca03b9c94c88 93 mySpeaker.PlaySong(note,duration);
tpettet3 3:dbae62823ec8 94 score++;
tpettet3 8:e6e1e5b3f2a9 95 pos1 = 0;//set the position to 0 after succesful hit to prevent multiple hits
tpettet3 3:dbae62823ec8 96 }
tpettet3 3:dbae62823ec8 97 if (value==16&&pos2==1)
tpettet3 3:dbae62823ec8 98 {
tpettet3 6:ca03b9c94c88 99 mySpeaker.PlaySong(note,duration);
tpettet3 3:dbae62823ec8 100 score++;
tpettet3 7:5a8f9a018e1f 101 pos2 = 0;
tpettet3 3:dbae62823ec8 102 }
tpettet3 3:dbae62823ec8 103 if (value==1&&pos3==1)
tpettet3 6:ca03b9c94c88 104 {
tpettet3 6:ca03b9c94c88 105 mySpeaker.PlaySong(note,duration);
tpettet3 1:89fd0d713ffc 106 score++;
tpettet3 7:5a8f9a018e1f 107 pos3 = 0;
tpettet3 1:89fd0d713ffc 108 }
tpettet3 3:dbae62823ec8 109 if (value==512&&pos4==1)
tpettet3 3:dbae62823ec8 110 {
tpettet3 6:ca03b9c94c88 111 mySpeaker.PlaySong(note,duration);
tpettet3 3:dbae62823ec8 112 score++;
tpettet3 7:5a8f9a018e1f 113 pos4 = 0;
tpettet3 3:dbae62823ec8 114 }
tpettet3 3:dbae62823ec8 115 if (value==32&&pos5==1)
tpettet3 3:dbae62823ec8 116 {
tpettet3 6:ca03b9c94c88 117 mySpeaker.PlaySong(note,duration);
tpettet3 3:dbae62823ec8 118 score++;
tpettet3 7:5a8f9a018e1f 119 pos5 = 0;
tpettet3 3:dbae62823ec8 120 }
tpettet3 3:dbae62823ec8 121 if (value==2&&pos6==1)
tpettet3 3:dbae62823ec8 122 {
tpettet3 6:ca03b9c94c88 123 mySpeaker.PlaySong(note,duration);
tpettet3 3:dbae62823ec8 124 score++;
tpettet3 7:5a8f9a018e1f 125 pos6 = 0;
tpettet3 3:dbae62823ec8 126 }
tpettet3 8:e6e1e5b3f2a9 127 //pc.printf("MPR value: %x \r\n", value); //debug code to the COM port that prints MPR value
tpettet3 1:89fd0d713ffc 128 //i=0;
4180_1 0:e09703934ff4 129 // puts key number out to LEDs for demo
tpettet3 1:89fd0d713ffc 130 /* for (i=0; i<12; i++) {
4180_1 0:e09703934ff4 131 if (((value>>i)&0x01)==1) key_code=i+1;
4180_1 0:e09703934ff4 132 }
4180_1 0:e09703934ff4 133 led4=key_code & 0x01;
4180_1 0:e09703934ff4 134 led3=(key_code>>1) & 0x01;
4180_1 0:e09703934ff4 135 led2=(key_code>>2) & 0x01;
tpettet3 1:89fd0d713ffc 136 led1=(key_code>>3) & 0x01;*/
4180_1 0:e09703934ff4 137 }
tpettet3 1:89fd0d713ffc 138 float arand;
tpettet3 1:89fd0d713ffc 139 unsigned int state;
tpettet3 1:89fd0d713ffc 140
4180_1 0:e09703934ff4 141 int main() {
tpettet3 1:89fd0d713ffc 142 lcd.baudrate(300000);
tpettet3 1:89fd0d713ffc 143
tpettet3 1:89fd0d713ffc 144 int out = 0xFF0000;// outline color
tpettet3 1:89fd0d713ffc 145 int fill = 0x0000;// fill color. aka no mole
tpettet3 1:89fd0d713ffc 146 int col1 = 21;
tpettet3 1:89fd0d713ffc 147 int col2 = 64;
tpettet3 1:89fd0d713ffc 148 int col3=107;
tpettet3 4:4cb02cde783c 149 int row3=107;
tpettet3 1:89fd0d713ffc 150 int row2=64;
tpettet3 4:4cb02cde783c 151 int row1=21;
tpettet3 1:89fd0d713ffc 152 int r = 20;
tpettet3 1:89fd0d713ffc 153 int rmole=18;//radius mole
tpettet3 1:89fd0d713ffc 154 int mole= 0xD3D3D3;//mole color like gray
tpettet3 1:89fd0d713ffc 155
tpettet3 1:89fd0d713ffc 156 lcd.circle(col1, row1 , r, out);// all empty
tpettet3 1:89fd0d713ffc 157 lcd.circle(col1, row2 , r, out);
tpettet3 1:89fd0d713ffc 158 lcd.circle(col2, row1 , r, out);
tpettet3 1:89fd0d713ffc 159 lcd.circle(col2, row2 , r, out);
tpettet3 1:89fd0d713ffc 160 lcd.circle(col3, row1 , r, out);
tpettet3 1:89fd0d713ffc 161 lcd.circle(col3, row2 , r, out);
4180_1 0:e09703934ff4 162
4180_1 0:e09703934ff4 163 pc.printf("\nHello from the mbed & mpr121\n\r");
4180_1 0:e09703934ff4 164
4180_1 0:e09703934ff4 165 unsigned char dataArray[2];
4180_1 0:e09703934ff4 166 int key;
4180_1 0:e09703934ff4 167 int count = 0;
4180_1 0:e09703934ff4 168
4180_1 0:e09703934ff4 169 pc.printf("Test 1: read a value: \r\n");
4180_1 0:e09703934ff4 170 dataArray[0] = mpr121.read(AFE_CFG);
4180_1 0:e09703934ff4 171 pc.printf("Read value=%x\r\n\n",dataArray[0]);
4180_1 0:e09703934ff4 172
4180_1 0:e09703934ff4 173 pc.printf("Test 2: read a value: \r\n");
4180_1 0:e09703934ff4 174 dataArray[0] = mpr121.read(0x5d);
4180_1 0:e09703934ff4 175 pc.printf("Read value=%x\r\n\n",dataArray[0]);
4180_1 0:e09703934ff4 176
4180_1 0:e09703934ff4 177 pc.printf("Test 3: write & read a value: \r\n");
4180_1 0:e09703934ff4 178 mpr121.read(ELE0_T);
4180_1 0:e09703934ff4 179 mpr121.write(ELE0_T,0x22);
4180_1 0:e09703934ff4 180 dataArray[0] = mpr121.read(ELE0_T);
4180_1 0:e09703934ff4 181 pc.printf("Read value=%x\r\n\n",dataArray[0]);
4180_1 0:e09703934ff4 182
4180_1 0:e09703934ff4 183 pc.printf("Test 4: Write many values: \r\n");
4180_1 0:e09703934ff4 184 unsigned char data[] = {0x1,0x3,0x5,0x9,0x15,0x25,0x41};
4180_1 0:e09703934ff4 185 mpr121.writeMany(0x42,data,7);
4180_1 0:e09703934ff4 186
4180_1 0:e09703934ff4 187 // Now read them back ..
4180_1 0:e09703934ff4 188 key = 0x42;
4180_1 0:e09703934ff4 189 count = 0;
4180_1 0:e09703934ff4 190 while (count < 7) {
4180_1 0:e09703934ff4 191 char result = mpr121.read(key);
4180_1 0:e09703934ff4 192 key++;
4180_1 0:e09703934ff4 193 count++;
4180_1 0:e09703934ff4 194 pc.printf("Read value: '%x'=%x\n\r",key,result);
4180_1 0:e09703934ff4 195 }
4180_1 0:e09703934ff4 196
4180_1 0:e09703934ff4 197 pc.printf("Test 5: Read Electrodes:\r\n");
4180_1 0:e09703934ff4 198 key = ELE0_T;
4180_1 0:e09703934ff4 199 count = 0;
4180_1 0:e09703934ff4 200 while (count < 24) {
4180_1 0:e09703934ff4 201 char result = mpr121.read(key);
4180_1 0:e09703934ff4 202 pc.printf("Read key:%x value:%x\n\r",key,result);
4180_1 0:e09703934ff4 203 key++;
4180_1 0:e09703934ff4 204 count++;
4180_1 0:e09703934ff4 205 }
4180_1 0:e09703934ff4 206 pc.printf("--------- \r\n\n");
4180_1 0:e09703934ff4 207
4180_1 0:e09703934ff4 208 // mpr121.setProximityMode(true);
4180_1 0:e09703934ff4 209
4180_1 0:e09703934ff4 210 pc.printf("ELE_CFG=%x", mpr121.read(ELE_CFG));
4180_1 0:e09703934ff4 211
4180_1 0:e09703934ff4 212 interrupt.fall(&fallInterrupt);
4180_1 0:e09703934ff4 213 interrupt.mode(PullUp);
tpettet3 1:89fd0d713ffc 214 int counter = 0;
tpettet3 8:e6e1e5b3f2a9 215 srand(state);
tpettet3 8:e6e1e5b3f2a9 216 while (counter < 30) {
tpettet3 1:89fd0d713ffc 217 arand = Ain.read()*1000000;
tpettet3 1:89fd0d713ffc 218 state = arand;
tpettet3 8:e6e1e5b3f2a9 219
tpettet3 1:89fd0d713ffc 220 state = rand()%15;
tpettet3 1:89fd0d713ffc 221 pc.printf("%i\n\r",state);
tpettet3 1:89fd0d713ffc 222 switch(state)
tpettet3 1:89fd0d713ffc 223 {
tpettet3 1:89fd0d713ffc 224 case 0:
tpettet3 3:dbae62823ec8 225 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 226 pos1=1;
tpettet3 1:89fd0d713ffc 227 pos2=0;
tpettet3 1:89fd0d713ffc 228 pos3=0;
tpettet3 1:89fd0d713ffc 229 pos4=0;
tpettet3 1:89fd0d713ffc 230 pos5=0;
tpettet3 1:89fd0d713ffc 231 pos6=0;
tpettet3 3:dbae62823ec8 232 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 233 pc.printf("%i should be 0 \n\r",state);
tpettet3 1:89fd0d713ffc 234 lcd.filled_circle(col1, row1 , rmole, fill);// 1
tpettet3 1:89fd0d713ffc 235 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 236 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 237 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 238 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 239 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 240 lcd.filled_circle(col1, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 241 break;
tpettet3 1:89fd0d713ffc 242 case 1:
tpettet3 3:dbae62823ec8 243 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 244 pos1=0;
tpettet3 1:89fd0d713ffc 245 pos2=1;
tpettet3 1:89fd0d713ffc 246 pos3=0;
tpettet3 1:89fd0d713ffc 247 pos4=0;
tpettet3 1:89fd0d713ffc 248 pos5=0;
tpettet3 1:89fd0d713ffc 249 pos6=0;
tpettet3 3:dbae62823ec8 250 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 251 pc.printf("%i should be 1 \n\r",state);
tpettet3 1:89fd0d713ffc 252 lcd.filled_circle(col1, row1 , rmole, fill);// 2
tpettet3 1:89fd0d713ffc 253 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 254 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 255 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 256 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 257 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 258 lcd.filled_circle(col2, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 259 break;
tpettet3 1:89fd0d713ffc 260 case 2:
tpettet3 3:dbae62823ec8 261 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 262 pos1=0;
tpettet3 1:89fd0d713ffc 263 pos2=0;
tpettet3 1:89fd0d713ffc 264 pos3=1;
tpettet3 1:89fd0d713ffc 265 pos4=0;
tpettet3 1:89fd0d713ffc 266 pos5=0;
tpettet3 1:89fd0d713ffc 267 pos6=0;
tpettet3 3:dbae62823ec8 268 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 269 pc.printf("%i should be 2 \n\r",state);
tpettet3 1:89fd0d713ffc 270 lcd.filled_circle(col1, row1 , rmole, fill);// 3
tpettet3 1:89fd0d713ffc 271 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 272 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 273 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 274 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 275 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 276 lcd.filled_circle(col3, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 277 break;
tpettet3 1:89fd0d713ffc 278 case 3:
tpettet3 3:dbae62823ec8 279 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 280 pos1=0;
tpettet3 1:89fd0d713ffc 281 pos2=0;
tpettet3 1:89fd0d713ffc 282 pos3=0;
tpettet3 1:89fd0d713ffc 283 pos4=1;
tpettet3 1:89fd0d713ffc 284 pos5=0;
tpettet3 1:89fd0d713ffc 285 pos6=0;
tpettet3 3:dbae62823ec8 286 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 287 pc.printf("%i should be 3 \n\r",state);
tpettet3 1:89fd0d713ffc 288 lcd.filled_circle(col1, row1 , rmole, fill);// 4
tpettet3 1:89fd0d713ffc 289 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 290 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 291 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 292 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 293 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 294 lcd.filled_circle(col1, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 295 break;
tpettet3 1:89fd0d713ffc 296 case 4:
tpettet3 3:dbae62823ec8 297 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 298 pos1=0;
tpettet3 1:89fd0d713ffc 299 pos2=0;
tpettet3 1:89fd0d713ffc 300 pos3=0;
tpettet3 1:89fd0d713ffc 301 pos4=0;
tpettet3 1:89fd0d713ffc 302 pos5=1;
tpettet3 1:89fd0d713ffc 303 pos6=0;
tpettet3 3:dbae62823ec8 304 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 305 pc.printf("%i should be 4 \n\r",state);
tpettet3 1:89fd0d713ffc 306 lcd.filled_circle(col1, row1 , rmole, fill);// 5
tpettet3 1:89fd0d713ffc 307 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 308 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 309 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 310 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 311 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 312 lcd.filled_circle(col2, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 313 break;
tpettet3 1:89fd0d713ffc 314 case 5:
tpettet3 3:dbae62823ec8 315 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 316 pos1=0;
tpettet3 1:89fd0d713ffc 317 pos2=0;
tpettet3 1:89fd0d713ffc 318 pos3=0;
tpettet3 1:89fd0d713ffc 319 pos4=0;
tpettet3 1:89fd0d713ffc 320 pos5=0;
tpettet3 1:89fd0d713ffc 321 pos6=1;
tpettet3 3:dbae62823ec8 322 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 323 pc.printf("%i should be 5 \n\r",state);
tpettet3 1:89fd0d713ffc 324
tpettet3 1:89fd0d713ffc 325 lcd.filled_circle(col1, row1 , rmole, fill);// 6
tpettet3 1:89fd0d713ffc 326 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 327 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 328 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 329 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 330 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 331 lcd.filled_circle(col2, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 332 break;
tpettet3 1:89fd0d713ffc 333 case 6:
tpettet3 3:dbae62823ec8 334 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 335 pos1=0;
tpettet3 1:89fd0d713ffc 336 pos2=1;
tpettet3 1:89fd0d713ffc 337 pos3=0;
tpettet3 1:89fd0d713ffc 338 pos4=0;
tpettet3 1:89fd0d713ffc 339 pos5=0;
tpettet3 1:89fd0d713ffc 340 pos6=1;
tpettet3 3:dbae62823ec8 341 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 342 pc.printf("%i should be 6 \n\r",state);
tpettet3 1:89fd0d713ffc 343 lcd.filled_circle(col1, row1 , rmole, fill);// 2,6
tpettet3 1:89fd0d713ffc 344 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 345 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 346 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 347 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 348 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 349 lcd.filled_circle(col2, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 350 lcd.filled_circle(col3, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 351 break;
tpettet3 1:89fd0d713ffc 352 case 7:
tpettet3 3:dbae62823ec8 353 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 354 pos1=1;
tpettet3 1:89fd0d713ffc 355 pos2=0;
tpettet3 1:89fd0d713ffc 356 pos3=1;
tpettet3 1:89fd0d713ffc 357 pos4=0;
tpettet3 1:89fd0d713ffc 358 pos5=0;
tpettet3 1:89fd0d713ffc 359 pos6=0;
tpettet3 3:dbae62823ec8 360 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 361 pc.printf("%i should be 7 \n\r",state);
tpettet3 1:89fd0d713ffc 362 lcd.filled_circle(col1, row1 , rmole, fill);// 1,3
tpettet3 1:89fd0d713ffc 363 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 364 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 365 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 366 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 367 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 368 lcd.filled_circle(col1, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 369 lcd.filled_circle(col3, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 370 break;
tpettet3 1:89fd0d713ffc 371 case 8:
tpettet3 3:dbae62823ec8 372 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 373 pos1=0;
tpettet3 1:89fd0d713ffc 374 pos2=1;
tpettet3 1:89fd0d713ffc 375 pos3=0;
tpettet3 1:89fd0d713ffc 376 pos4=1;
tpettet3 1:89fd0d713ffc 377 pos5=0;
tpettet3 1:89fd0d713ffc 378 pos6=1;
tpettet3 3:dbae62823ec8 379 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 380 pc.printf("%i should be 8 \n\r",state);
tpettet3 1:89fd0d713ffc 381
tpettet3 1:89fd0d713ffc 382 lcd.filled_circle(col1, row1 , rmole, fill);// 2,4,6
tpettet3 1:89fd0d713ffc 383 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 384 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 385 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 386 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 387 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 388 lcd.filled_circle(col2, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 389 lcd.filled_circle(col2, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 390 lcd.filled_circle(col3, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 391 break;
tpettet3 1:89fd0d713ffc 392 case 9:
tpettet3 3:dbae62823ec8 393 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 394 pos1=0;
tpettet3 1:89fd0d713ffc 395 pos2=0;
tpettet3 1:89fd0d713ffc 396 pos3=1;
tpettet3 1:89fd0d713ffc 397 pos4=1;
tpettet3 1:89fd0d713ffc 398 pos5=0;
tpettet3 1:89fd0d713ffc 399 pos6=1;
tpettet3 3:dbae62823ec8 400 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 401 pc.printf("%i should be 9 \n\r",state);
tpettet3 1:89fd0d713ffc 402 lcd.filled_circle(col1, row1 , rmole, fill);// 3,4,6
tpettet3 1:89fd0d713ffc 403 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 404 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 405 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 406 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 407 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 408 lcd.filled_circle(col3, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 409 lcd.filled_circle(col1, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 410 lcd.filled_circle(col3, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 411 break;
tpettet3 1:89fd0d713ffc 412 case 10:
tpettet3 3:dbae62823ec8 413 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 414 pos1=1;
tpettet3 1:89fd0d713ffc 415 pos2=0;
tpettet3 1:89fd0d713ffc 416 pos3=0;
tpettet3 1:89fd0d713ffc 417 pos4=0;
tpettet3 1:89fd0d713ffc 418 pos5=0;
tpettet3 1:89fd0d713ffc 419 pos6=1;
tpettet3 3:dbae62823ec8 420 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 421 pc.printf("%i should be 10 \n\r",state);
tpettet3 1:89fd0d713ffc 422 lcd.filled_circle(col1, row1 , rmole, fill);// 1,6
tpettet3 1:89fd0d713ffc 423 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 424 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 425 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 426 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 427 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 428 lcd.filled_circle(col1, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 429 lcd.filled_circle(col3, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 430 break;
tpettet3 1:89fd0d713ffc 431 case 11:
tpettet3 3:dbae62823ec8 432 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 433 pos1=0;
tpettet3 1:89fd0d713ffc 434 pos2=1;
tpettet3 1:89fd0d713ffc 435 pos3=1;
tpettet3 1:89fd0d713ffc 436 pos4=0;
tpettet3 1:89fd0d713ffc 437 pos5=1;
tpettet3 1:89fd0d713ffc 438 pos6=1;
tpettet3 3:dbae62823ec8 439 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 440 pc.printf("%i should be 11 \n\r",state);
tpettet3 1:89fd0d713ffc 441 lcd.filled_circle(col1, row1 , rmole, fill);// 2,3,5,6
tpettet3 1:89fd0d713ffc 442 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 443 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 444 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 445 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 446 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 447 lcd.filled_circle(col2, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 448 lcd.filled_circle(col3, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 449 lcd.filled_circle(col2, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 450 lcd.filled_circle(col3, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 451 break;
tpettet3 1:89fd0d713ffc 452 case 12:
tpettet3 3:dbae62823ec8 453 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 454 pos1=0;
tpettet3 1:89fd0d713ffc 455 pos2=0;
tpettet3 1:89fd0d713ffc 456 pos3=1;
tpettet3 1:89fd0d713ffc 457 pos4=0;
tpettet3 1:89fd0d713ffc 458 pos5=1;
tpettet3 1:89fd0d713ffc 459 pos6=0;
tpettet3 3:dbae62823ec8 460 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 461 pc.printf("%i should be 12 \n\r",state);
tpettet3 1:89fd0d713ffc 462 lcd.filled_circle(col1, row1 , rmole, fill);// 3,5
tpettet3 1:89fd0d713ffc 463 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 464 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 465 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 466 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 467 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 468 lcd.filled_circle(col3, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 469 lcd.filled_circle(col2, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 470 break;
tpettet3 1:89fd0d713ffc 471 case 13:
tpettet3 3:dbae62823ec8 472 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 473 pos1=1;
tpettet3 1:89fd0d713ffc 474 pos2=0;
tpettet3 1:89fd0d713ffc 475 pos3=0;
tpettet3 1:89fd0d713ffc 476 pos4=1;
tpettet3 1:89fd0d713ffc 477 pos5=1;
tpettet3 1:89fd0d713ffc 478 pos6=0;
tpettet3 3:dbae62823ec8 479 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 480 pc.printf("%i should be 13 \n\r",state);
tpettet3 1:89fd0d713ffc 481 lcd.filled_circle(col1, row1 , rmole, fill);// 1,4,5
tpettet3 1:89fd0d713ffc 482 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 483 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 484 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 485 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 486 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 487 lcd.filled_circle(col1, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 488 lcd.filled_circle(col1, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 489 lcd.filled_circle(col2, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 490 break;
tpettet3 1:89fd0d713ffc 491 case 14:
tpettet3 3:dbae62823ec8 492 //POS_MUTEX.lock();
tpettet3 1:89fd0d713ffc 493 pos1=0;
tpettet3 1:89fd0d713ffc 494 pos2=1;
tpettet3 1:89fd0d713ffc 495 pos3=0;
tpettet3 1:89fd0d713ffc 496 pos4=0;
tpettet3 1:89fd0d713ffc 497 pos5=1;
tpettet3 1:89fd0d713ffc 498 pos6=0;
tpettet3 3:dbae62823ec8 499 //POS_MUTEX.unlock();
tpettet3 1:89fd0d713ffc 500 pc.printf("%i should be 14 \n\r",state);
tpettet3 1:89fd0d713ffc 501
tpettet3 1:89fd0d713ffc 502 lcd.filled_circle(col1, row1 , rmole, fill);// 2,5
tpettet3 1:89fd0d713ffc 503 lcd.filled_circle(col1, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 504 lcd.filled_circle(col2, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 505 lcd.filled_circle(col2, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 506 lcd.filled_circle(col3, row1 , rmole, fill);
tpettet3 1:89fd0d713ffc 507 lcd.filled_circle(col3, row2 , rmole, fill);
tpettet3 1:89fd0d713ffc 508 lcd.filled_circle(col2, row1 , rmole, mole);
tpettet3 1:89fd0d713ffc 509 lcd.filled_circle(col2, row2 , rmole, mole);
tpettet3 1:89fd0d713ffc 510 break;
tpettet3 1:89fd0d713ffc 511 }
tpettet3 8:e6e1e5b3f2a9 512 wait(0.5);
tpettet3 1:89fd0d713ffc 513 counter++;
tpettet3 1:89fd0d713ffc 514 }
tpettet3 8:e6e1e5b3f2a9 515 lcd.cls();
tpettet3 3:dbae62823ec8 516 wait(3);
tpettet3 7:5a8f9a018e1f 517 lcd.cls();
tpettet3 7:5a8f9a018e1f 518 /* mkdir("/sd/mydir", 0777);
tpettet3 7:5a8f9a018e1f 519 FILE *fp = fopen("/sd/mydir/highscore.txt", "w");
tpettet3 7:5a8f9a018e1f 520 pc.printf("Could not open file for write\n");
tpettet3 7:5a8f9a018e1f 521
tpettet3 7:5a8f9a018e1f 522 fprintf(fp,"titties");
tpettet3 7:5a8f9a018e1f 523 fclose(fp);
tpettet3 7:5a8f9a018e1f 524
tpettet3 7:5a8f9a018e1f 525 lcd.printf("The high schore is %s,
tpettet3 4:4cb02cde783c 526 lcd.printf("you scored %D",score);
tpettet3 7:5a8f9a018e1f 527 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
tpettet3 5:070755be0a77 528 if(fp == NULL) {
tpettet3 5:070755be0a77 529 pc.printf("Could not open file for write\n");
tpettet3 5:070755be0a77 530 }
tpettet3 5:070755be0a77 531 fprintf(fp, "Hello fun SD Card World!");
tpettet3 7:5a8f9a018e1f 532 fclose(fp);*//*
tpettet3 7:5a8f9a018e1f 533 char str [80];
tpettet3 7:5a8f9a018e1f 534 mkdir("/sd/mydir", 0777);
tpettet3 7:5a8f9a018e1f 535 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
tpettet3 7:5a8f9a018e1f 536 if(fp == NULL) {
tpettet3 7:5a8f9a018e1f 537 pc.printf("Could not open file for write\n");
tpettet3 5:070755be0a77 538 }
tpettet3 7:5a8f9a018e1f 539 fprintf(fp, "%d is the high score score);
tpettet3 7:5a8f9a018e1f 540 fclose(fp); FILE *fp1 = fopen("/sd/mydir/sdtest.txt", "r");
tpettet3 5:070755be0a77 541 if(fp1 == NULL)
tpettet3 5:070755be0a77 542 {
tpettet3 7:5a8f9a018e1f 543 pc.printf("Could not open file for read\n");
tpettet3 5:070755be0a77 544 }
tpettet3 5:070755be0a77 545 pc.printf("Opened file for read\n\r");
tpettet3 5:070755be0a77 546 fscanf (fp1, "%s", str);
tpettet3 5:070755be0a77 547 pc.printf ("I have read: %s \n",str);
tpettet3 5:070755be0a77 548 fclose(fp1);
tpettet3 7:5a8f9a018e1f 549
tpettet3 7:5a8f9a018e1f 550 pc.printf("Goodbye World!\n");*/
tpettet3 7:5a8f9a018e1f 551 int please;
tpettet3 7:5a8f9a018e1f 552 mkdir("/sd/mydir", 0777);
tpettet3 7:5a8f9a018e1f 553 FILE *fp1 = fopen("/sd/mydir/sdtest.txt", "r");
tpettet3 7:5a8f9a018e1f 554 if(fp1 == NULL)
tpettet3 7:5a8f9a018e1f 555 {
tpettet3 7:5a8f9a018e1f 556 pc.printf("Could not open file for read\n");
tpettet3 7:5a8f9a018e1f 557 }
tpettet3 7:5a8f9a018e1f 558 pc.printf("Opened file for read\n\r");
tpettet3 7:5a8f9a018e1f 559 fscanf (fp1, "%s", str);
tpettet3 7:5a8f9a018e1f 560 sscanf(str, "%d", &please);
tpettet3 7:5a8f9a018e1f 561 fclose(fp1);
tpettet3 8:e6e1e5b3f2a9 562 pc.printf (": %d \n",please);
tpettet3 8:e6e1e5b3f2a9 563 if (score > please)
tpettet3 8:e6e1e5b3f2a9 564 {
tpettet3 8:e6e1e5b3f2a9 565 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
tpettet3 8:e6e1e5b3f2a9 566 if(fp == NULL) {
tpettet3 7:5a8f9a018e1f 567 error("Could not open file for write\n");
tpettet3 7:5a8f9a018e1f 568 }
tpettet3 7:5a8f9a018e1f 569 char buf[10];
tpettet3 8:e6e1e5b3f2a9 570 sprintf(buf, "%d", score);
tpettet3 7:5a8f9a018e1f 571 fprintf(fp, "%s",buf);
tpettet3 7:5a8f9a018e1f 572 fclose(fp);
tpettet3 8:e6e1e5b3f2a9 573 lcd.printf("CONGRATULATIONS!\n\n");
tpettet3 8:e6e1e5b3f2a9 574 lcd.printf("You set the new\n\n");
tpettet3 8:e6e1e5b3f2a9 575 lcd.printf("High score!!!!!!\n\n");
tpettet3 8:e6e1e5b3f2a9 576 lcd.printf("New high score: %d\n\n",score);
tpettet3 8:e6e1e5b3f2a9 577 lcd.printf("Press reset to\n\n");
tpettet3 8:e6e1e5b3f2a9 578 lcd.printf("Play Again!");
tpettet3 8:e6e1e5b3f2a9 579 }
tpettet3 8:e6e1e5b3f2a9 580 else
tpettet3 8:e6e1e5b3f2a9 581 {
tpettet3 8:e6e1e5b3f2a9 582 lcd.printf("High score: %d\n\n",please);
tpettet3 8:e6e1e5b3f2a9 583 lcd.printf("Your score: %d\n\n",score);
tpettet3 8:e6e1e5b3f2a9 584 lcd.printf("You did not set\n\n");
tpettet3 8:e6e1e5b3f2a9 585 lcd.printf("A new high score\n\n");
tpettet3 8:e6e1e5b3f2a9 586 lcd.printf("Press reset to\n\n");
tpettet3 8:e6e1e5b3f2a9 587 lcd.printf("Try again)");
tpettet3 8:e6e1e5b3f2a9 588 }
tpettet3 8:e6e1e5b3f2a9 589
tpettet3 8:e6e1e5b3f2a9 590
tpettet3 8:e6e1e5b3f2a9 591 /*
tpettet3 7:5a8f9a018e1f 592 FILE *fp2 = fopen("/sd/mydir/sdtest.txt", "r");
tpettet3 7:5a8f9a018e1f 593 if(fp2 == NULL)
tpettet3 7:5a8f9a018e1f 594 {
tpettet3 7:5a8f9a018e1f 595 error("Could not open file for read\n");
tpettet3 7:5a8f9a018e1f 596 }
tpettet3 7:5a8f9a018e1f 597 pc.printf("Opened file for read\n\r");
tpettet3 7:5a8f9a018e1f 598 fscanf (fp2, "%s", str);
tpettet3 7:5a8f9a018e1f 599 sscanf(str, "%d", &please);
tpettet3 7:5a8f9a018e1f 600 pc.printf ("I have read: %s \n",str);
tpettet3 7:5a8f9a018e1f 601 fclose(fp2);
tpettet3 7:5a8f9a018e1f 602 if (please == 5)
tpettet3 7:5a8f9a018e1f 603 {
tpettet3 7:5a8f9a018e1f 604 pc.printf("we got it\n");
tpettet3 8:e6e1e5b3f2a9 605 }*/
tpettet3 7:5a8f9a018e1f 606 pc.printf("Goodbye World!\n");
tpettet3 8:e6e1e5b3f2a9 607 }//end
4180_1 0:e09703934ff4 608
4180_1 0:e09703934ff4 609
4180_1 0:e09703934ff4 610
tpettet3 1:89fd0d713ffc 611