vmh

Dependencies:   mbed

Committer:
wonner163
Date:
Mon Dec 11 08:43:44 2017 +0000
Revision:
0:4562b55bbb43
Child:
1:b4814760d8ee
12

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wonner163 0:4562b55bbb43 1 #include "mbed.h"
wonner163 0:4562b55bbb43 2 #include "ColorMbed.h"
wonner163 0:4562b55bbb43 3 #include "TextLCD.h"
wonner163 0:4562b55bbb43 4
wonner163 0:4562b55bbb43 5 ColorMbed dotmatrix;
wonner163 0:4562b55bbb43 6 Serial bt(PA_15, PB_7);
wonner163 0:4562b55bbb43 7 Serial pc(D1,D0);
wonner163 0:4562b55bbb43 8
wonner163 0:4562b55bbb43 9
wonner163 0:4562b55bbb43 10 I2C i2c_lcd(D14,D15); // SDA, SCL
wonner163 0:4562b55bbb43 11 TextLCD_I2C lcd(&i2c_lcd, 0x4E, TextLCD::LCD16x2, TextLCD::HD44780); // I2C bus, PCF8574 Slaveaddress, LCD Type, Device Type
wonner163 0:4562b55bbb43 12
wonner163 0:4562b55bbb43 13
wonner163 0:4562b55bbb43 14 int main(void)
wonner163 0:4562b55bbb43 15 {
wonner163 0:4562b55bbb43 16 int ch;
wonner163 0:4562b55bbb43 17 int x=0;
wonner163 0:4562b55bbb43 18 int x0=0;
wonner163 0:4562b55bbb43 19 int x1=0;
wonner163 0:4562b55bbb43 20 int x2=0;
wonner163 0:4562b55bbb43 21 int x3=0;
wonner163 0:4562b55bbb43 22 int x4=0;
wonner163 0:4562b55bbb43 23 int x5=0;
wonner163 0:4562b55bbb43 24 int x6=0;
wonner163 0:4562b55bbb43 25 int x7=0;
wonner163 0:4562b55bbb43 26 int x8=0;
wonner163 0:4562b55bbb43 27 int amount =0;
wonner163 0:4562b55bbb43 28 int stateprint1 = 0;
wonner163 0:4562b55bbb43 29 int stateprint2 = 0;
wonner163 0:4562b55bbb43 30 int stateprint3 = 0;
wonner163 0:4562b55bbb43 31 int stateprint4 = 0;
wonner163 0:4562b55bbb43 32 int stateprint5 = 0;
wonner163 0:4562b55bbb43 33 int stateprint6 = 0;
wonner163 0:4562b55bbb43 34
wonner163 0:4562b55bbb43 35 // uint8_t rgb[3] = {255,255,100};
wonner163 0:4562b55bbb43 36 uint8_t rgbready[3] = {100,100,100}; //เริ่มต้นสีโรสโกล
wonner163 0:4562b55bbb43 37 uint8_t green[3] = {0,255,0}; //ไฟเขียว
wonner163 0:4562b55bbb43 38 uint8_t red[3] = {0,0,100}; //ไฟเฟล:ไม่ถึงองศาที่ต้องการ
wonner163 0:4562b55bbb43 39 uint8_t yellow[3] = {0,150,200}; // ไฟสีเหลือง
wonner163 0:4562b55bbb43 40
wonner163 0:4562b55bbb43 41
wonner163 0:4562b55bbb43 42
wonner163 0:4562b55bbb43 43 uint8_t tast[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; //เทสไฟติดเต็มแผ่น
wonner163 0:4562b55bbb43 44 uint8_t complete[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF}; //สำเร็จติดสองแถว
wonner163 0:4562b55bbb43 45 uint8_t Ncomplete[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF}; //ไม่สำร็จติดสองแถว
wonner163 0:4562b55bbb43 46
wonner163 0:4562b55bbb43 47
wonner163 0:4562b55bbb43 48
wonner163 0:4562b55bbb43 49
wonner163 0:4562b55bbb43 50
wonner163 0:4562b55bbb43 51
wonner163 0:4562b55bbb43 52 //คิดว่าไม่น่าใช้
wonner163 0:4562b55bbb43 53 /*uint8_t pic[8] = {0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; // ติด1ดวง
wonner163 0:4562b55bbb43 54 uint8_t pic2[8] = {0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00}; // ติด 2 ดวง
wonner163 0:4562b55bbb43 55 uint8_t pic3[8] = {0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00};
wonner163 0:4562b55bbb43 56 uint8_t pic4[8] = {0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00};
wonner163 0:4562b55bbb43 57 uint8_t pic5[8] = {0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00};
wonner163 0:4562b55bbb43 58 uint8_t pic6[8] = {0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00};
wonner163 0:4562b55bbb43 59 uint8_t pic7[8] = {0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80};*/
wonner163 0:4562b55bbb43 60
wonner163 0:4562b55bbb43 61
wonner163 0:4562b55bbb43 62
wonner163 0:4562b55bbb43 63
wonner163 0:4562b55bbb43 64
wonner163 0:4562b55bbb43 65
wonner163 0:4562b55bbb43 66
wonner163 0:4562b55bbb43 67 // ระดับ left
wonner163 0:4562b55bbb43 68 uint8_t greenleft[8] = {0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00};
wonner163 0:4562b55bbb43 69 uint8_t yellowleft[8] = {0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00};
wonner163 0:4562b55bbb43 70 uint8_t redleft[8] = {0x80,0x80,0x00,0x00,0x00,0x00,0x80,0x80};
wonner163 0:4562b55bbb43 71 // right
wonner163 0:4562b55bbb43 72 uint8_t greenright[8] = {0x00,0x00,0x00,0x0,0x0,0x00,0x00,0x18};
wonner163 0:4562b55bbb43 73 uint8_t yellowright[8] = {0x00,0x00,0x0,0x00,0x00,0x00,0x00,0x24};
wonner163 0:4562b55bbb43 74 uint8_t redright[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC3};
wonner163 0:4562b55bbb43 75 // เลข 1-30
wonner163 0:4562b55bbb43 76 uint8_t zero[8] = {0x1C,0x14,0x14,0x14,0x14,0x14,0x1C,0x00};
wonner163 0:4562b55bbb43 77 uint8_t one[8] = {0x1C,0x08,0x08,0x08,0x08,0x18,0x08,0x00};
wonner163 0:4562b55bbb43 78 uint8_t two[8] = {0x1C,0x10,0x10,0x1C,0x04,0x04,0x1C,0x00};
wonner163 0:4562b55bbb43 79 uint8_t three[8] = {0x1C,0x04,0x04,0x1C,0x04,0x04,0x1C,0x00};
wonner163 0:4562b55bbb43 80 uint8_t four[8] = {0x04,0x04,0x04,0x1C,0x14,0x14,0x14,0x00};
wonner163 0:4562b55bbb43 81 uint8_t five[8] = {0x1C,0x04,0x04,0x1C,0x10,0x10,0x1C,0x00};
wonner163 0:4562b55bbb43 82 uint8_t six[8] = {0x1C,0x14,0x14,0x1C,0x10,0x10,0x1C,0x00};
wonner163 0:4562b55bbb43 83 uint8_t seven[8] = {0x04,0x04,0x04,0x04,0x04,0x04,0x1C,0x00};
wonner163 0:4562b55bbb43 84 uint8_t eight[8] = {0x1C,0x14,0x14,0x1C,0x14,0x14,0x1C,0x00};
wonner163 0:4562b55bbb43 85 uint8_t nine[8] = {0x1C,0x04,0x04,0x1C,0x14,0x14,0x1C,0x00};
wonner163 0:4562b55bbb43 86 uint8_t ten[8] = {0x3F,0x15,0x15,0x15,0x15,0x35,0x17,0x00};
wonner163 0:4562b55bbb43 87 uint8_t eleven[8] = {0x3F,0x12,0x12,0x12,0x12,0x36,0x12,0x00};
wonner163 0:4562b55bbb43 88 uint8_t twelve[8] = {0x3F,0x14,0x14,0x17,0x11,0x31,0x17,0x00};
wonner163 0:4562b55bbb43 89 uint8_t thirteen[8] = {0x3F,0x11,0x11,0x17,0x11,0x31,0x17,0x00};
wonner163 0:4562b55bbb43 90 uint8_t fourteen[8] = {0x39,0x11,0x11,0x17,0x15,0x35,0x15,0x00};
wonner163 0:4562b55bbb43 91 uint8_t fifteen[8] = {0x3F,0x11,0x11,0x17,0x14,0x34,0x17,0x00};
wonner163 0:4562b55bbb43 92 uint8_t sixteen[8] = {0x3F,0x15,0x15,0x17,0x14,0x34,0x17,0x00};
wonner163 0:4562b55bbb43 93 uint8_t seventeen[8] = {0x39,0x11,0x11,0x11,0x11,0x31,0x17,0x00};
wonner163 0:4562b55bbb43 94 uint8_t eightteen[8] = {0x3F,0x15,0x15,0x17,0x15,0x35,0x17,0x00};
wonner163 0:4562b55bbb43 95 uint8_t ninteen[8] = {0x3F,0x11,0x11,0x17,0x15,0x35,0x17,0x00};
wonner163 0:4562b55bbb43 96 uint8_t twenty[8] = {0x3F,0x25,0x25,0x3D,0x0D,0x0D,0x3F,0x00};
wonner163 0:4562b55bbb43 97 uint8_t twone[8] = {0x3F,0x22,0x22,0x3A,0x0A,0x0E,0x3A,0x00};
wonner163 0:4562b55bbb43 98 uint8_t twtwo[8] = {0x3F,0x24,0x24,0x3F,0x09,0x09,0x3F,0x00};
wonner163 0:4562b55bbb43 99 uint8_t twthree[8] = {0x3F,0x21,0x21,0x3F,0x09,0x09,0x3F,0x00};
wonner163 0:4562b55bbb43 100 uint8_t twfour[8] = {0x39,0x21,0x21,0x3F,0x0D,0x0D,0x3D,0x00};
wonner163 0:4562b55bbb43 101 uint8_t twfive[8] = {0x3F,0x21,0x21,0x3F,0xC,0xC,0x3F,0x00};
wonner163 0:4562b55bbb43 102 uint8_t twsix[8] = {0x3F,0x25,0x25,0x3F,0xC,0xC,0x3F,0x00};
wonner163 0:4562b55bbb43 103 uint8_t twseven[8] = {0x39,0x21,0x21,0x39,0x9,0x9,0x3F,0x00};
wonner163 0:4562b55bbb43 104 uint8_t tweight[8] = {0x3F,0x25,0x25,0x3F,0xD,0xD,0x3F,0x00};
wonner163 0:4562b55bbb43 105 uint8_t twnine[8] = {0x3F,0x21,0x21,0x3F,0xD,0xD,0x3F,0x00};
wonner163 0:4562b55bbb43 106 uint8_t thirty[8] = {0x3F,0xD,0xD,0x3D,0x0D,0x0D,0x3F,0x00};
wonner163 0:4562b55bbb43 107
wonner163 0:4562b55bbb43 108 //องศา
wonner163 0:4562b55bbb43 109 uint8_t gound[8] = {0x00,0x00,0x00,0x00,0x00,0x0,0x00,0x81}; //จุดสองจุด
wonner163 0:4562b55bbb43 110 uint8_t step1[8] = {0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x40}; //สเต็ปองศา
wonner163 0:4562b55bbb43 111 uint8_t step2[8] = {0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x60};
wonner163 0:4562b55bbb43 112 uint8_t step3[8] = {0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x70};
wonner163 0:4562b55bbb43 113 uint8_t step4[8] = {0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x78};
wonner163 0:4562b55bbb43 114 uint8_t step5[8] = {0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x7C};
wonner163 0:4562b55bbb43 115 uint8_t step6[8] = {0x00,0x0,0x0,0x0,0x0,0x0,0x0,0x7E};
wonner163 0:4562b55bbb43 116
wonner163 0:4562b55bbb43 117 dotmatrix.init();
wonner163 0:4562b55bbb43 118
wonner163 0:4562b55bbb43 119
wonner163 0:4562b55bbb43 120
wonner163 0:4562b55bbb43 121
wonner163 0:4562b55bbb43 122 do{
wonner163 0:4562b55bbb43 123 if(bt.readable()){
wonner163 0:4562b55bbb43 124 ch=bt.getc();
wonner163 0:4562b55bbb43 125 pc.printf("%d\n",ch);
wonner163 0:4562b55bbb43 126 }
wonner163 0:4562b55bbb43 127 if ((ch <=15 and ch >=0) or x==1){
wonner163 0:4562b55bbb43 128 if (stateprint1 == 0){
wonner163 0:4562b55bbb43 129 pc.printf(" pass step1 ");
wonner163 0:4562b55bbb43 130 lcd.cls();
wonner163 0:4562b55bbb43 131 lcd.printf(" pass step1 ");
wonner163 0:4562b55bbb43 132 stateprint1 =1;
wonner163 0:4562b55bbb43 133 }
wonner163 0:4562b55bbb43 134
wonner163 0:4562b55bbb43 135 dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 136 dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 137 //
wonner163 0:4562b55bbb43 138 // if (amount==0){
wonner163 0:4562b55bbb43 139 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 140 // lcd.cls();
wonner163 0:4562b55bbb43 141 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 142 // dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 143 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 144 // }
wonner163 0:4562b55bbb43 145 //
wonner163 0:4562b55bbb43 146 // if (amount==1){
wonner163 0:4562b55bbb43 147 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 148 // lcd.cls();
wonner163 0:4562b55bbb43 149 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 150 // dotmatrix.display_pic(two,green);
wonner163 0:4562b55bbb43 151 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 152 //
wonner163 0:4562b55bbb43 153 // }
wonner163 0:4562b55bbb43 154 //
wonner163 0:4562b55bbb43 155 // if (amount==2){
wonner163 0:4562b55bbb43 156 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 157 // lcd.cls();
wonner163 0:4562b55bbb43 158 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 159 // dotmatrix.display_pic(three,green);
wonner163 0:4562b55bbb43 160 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 161 //
wonner163 0:4562b55bbb43 162 // }
wonner163 0:4562b55bbb43 163 //
wonner163 0:4562b55bbb43 164 // if (amount==3){
wonner163 0:4562b55bbb43 165 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 166 // lcd.cls();
wonner163 0:4562b55bbb43 167 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 168 // dotmatrix.display_pic(four,green);
wonner163 0:4562b55bbb43 169 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 170 //
wonner163 0:4562b55bbb43 171 // }
wonner163 0:4562b55bbb43 172 //
wonner163 0:4562b55bbb43 173 // if (amount==4){
wonner163 0:4562b55bbb43 174 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 175 // lcd.cls();
wonner163 0:4562b55bbb43 176 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 177 // dotmatrix.display_pic(five,green);
wonner163 0:4562b55bbb43 178 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 179 //
wonner163 0:4562b55bbb43 180 // }
wonner163 0:4562b55bbb43 181 //
wonner163 0:4562b55bbb43 182 // if (amount==5){
wonner163 0:4562b55bbb43 183 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 184 // lcd.cls();
wonner163 0:4562b55bbb43 185 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 186 // dotmatrix.display_pic(six,green);
wonner163 0:4562b55bbb43 187 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 188 //
wonner163 0:4562b55bbb43 189 // }
wonner163 0:4562b55bbb43 190 //
wonner163 0:4562b55bbb43 191 // if (amount==6){
wonner163 0:4562b55bbb43 192 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 193 // lcd.cls();
wonner163 0:4562b55bbb43 194 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 195 // dotmatrix.display_pic(seven,green);
wonner163 0:4562b55bbb43 196 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 197 //
wonner163 0:4562b55bbb43 198 // }
wonner163 0:4562b55bbb43 199 //
wonner163 0:4562b55bbb43 200 // if (amount==7){
wonner163 0:4562b55bbb43 201 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 202 // lcd.cls();
wonner163 0:4562b55bbb43 203 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 204 // dotmatrix.display_pic(eight,green);
wonner163 0:4562b55bbb43 205 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 206 //
wonner163 0:4562b55bbb43 207 // }
wonner163 0:4562b55bbb43 208 //
wonner163 0:4562b55bbb43 209 // if (amount==8){
wonner163 0:4562b55bbb43 210 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 211 // lcd.cls();
wonner163 0:4562b55bbb43 212 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 213 // dotmatrix.display_pic(nine,green);
wonner163 0:4562b55bbb43 214 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 215 //
wonner163 0:4562b55bbb43 216 // }
wonner163 0:4562b55bbb43 217 //
wonner163 0:4562b55bbb43 218 // if (amount==9){
wonner163 0:4562b55bbb43 219 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 220 // lcd.cls();
wonner163 0:4562b55bbb43 221 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 222 // dotmatrix.display_pic(ten,green);
wonner163 0:4562b55bbb43 223 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 224 //
wonner163 0:4562b55bbb43 225 // }
wonner163 0:4562b55bbb43 226 x=1;
wonner163 0:4562b55bbb43 227 if((ch <=30 and ch >=16) or x2==1){
wonner163 0:4562b55bbb43 228 if (stateprint2 == 0){
wonner163 0:4562b55bbb43 229 pc.printf(" pass step2 ");
wonner163 0:4562b55bbb43 230 lcd.cls();
wonner163 0:4562b55bbb43 231 lcd.printf(" pass step2 ");
wonner163 0:4562b55bbb43 232 stateprint2 =1;
wonner163 0:4562b55bbb43 233 }
wonner163 0:4562b55bbb43 234 // if (amount==0){
wonner163 0:4562b55bbb43 235 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 236 // lcd.cls();
wonner163 0:4562b55bbb43 237 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 238 // dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 239 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 240 // }
wonner163 0:4562b55bbb43 241 //
wonner163 0:4562b55bbb43 242 // else if (amount==1){
wonner163 0:4562b55bbb43 243 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 244 // lcd.cls();
wonner163 0:4562b55bbb43 245 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 246 // dotmatrix.display_pic(two,green);
wonner163 0:4562b55bbb43 247 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 248 //
wonner163 0:4562b55bbb43 249 // }
wonner163 0:4562b55bbb43 250 //
wonner163 0:4562b55bbb43 251 // else if (amount==2){
wonner163 0:4562b55bbb43 252 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 253 // lcd.cls();
wonner163 0:4562b55bbb43 254 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 255 // dotmatrix.display_pic(three,green);
wonner163 0:4562b55bbb43 256 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 257 //
wonner163 0:4562b55bbb43 258 // }
wonner163 0:4562b55bbb43 259 //
wonner163 0:4562b55bbb43 260 // else if (amount==3){
wonner163 0:4562b55bbb43 261 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 262 // lcd.cls();
wonner163 0:4562b55bbb43 263 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 264 // dotmatrix.display_pic(four,green);
wonner163 0:4562b55bbb43 265 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 266 //
wonner163 0:4562b55bbb43 267 // }
wonner163 0:4562b55bbb43 268 //
wonner163 0:4562b55bbb43 269 // else if (amount==4){
wonner163 0:4562b55bbb43 270 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 271 // lcd.cls();
wonner163 0:4562b55bbb43 272 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 273 // dotmatrix.display_pic(five,green);
wonner163 0:4562b55bbb43 274 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 275 //
wonner163 0:4562b55bbb43 276 // }
wonner163 0:4562b55bbb43 277 //
wonner163 0:4562b55bbb43 278 // else if (amount==5){
wonner163 0:4562b55bbb43 279 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 280 // lcd.cls();
wonner163 0:4562b55bbb43 281 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 282 // dotmatrix.display_pic(six,green);
wonner163 0:4562b55bbb43 283 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 284 //
wonner163 0:4562b55bbb43 285 // }
wonner163 0:4562b55bbb43 286 //
wonner163 0:4562b55bbb43 287 // else if (amount==6){
wonner163 0:4562b55bbb43 288 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 289 // lcd.cls();
wonner163 0:4562b55bbb43 290 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 291 // dotmatrix.display_pic(seven,green);
wonner163 0:4562b55bbb43 292 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 293 //
wonner163 0:4562b55bbb43 294 // }
wonner163 0:4562b55bbb43 295 //
wonner163 0:4562b55bbb43 296 // else if (amount==7){
wonner163 0:4562b55bbb43 297 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 298 // lcd.cls();
wonner163 0:4562b55bbb43 299 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 300 // dotmatrix.display_pic(eight,green);
wonner163 0:4562b55bbb43 301 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 302 //
wonner163 0:4562b55bbb43 303 // }
wonner163 0:4562b55bbb43 304 //
wonner163 0:4562b55bbb43 305 // else if (amount==8){
wonner163 0:4562b55bbb43 306 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 307 // lcd.cls();
wonner163 0:4562b55bbb43 308 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 309 // dotmatrix.display_pic(nine,green);
wonner163 0:4562b55bbb43 310 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 311 //
wonner163 0:4562b55bbb43 312 // }
wonner163 0:4562b55bbb43 313 //
wonner163 0:4562b55bbb43 314 // else if (amount==9){
wonner163 0:4562b55bbb43 315 // pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 316 // lcd.cls();
wonner163 0:4562b55bbb43 317 // lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 318 // dotmatrix.display_pic(ten,green);
wonner163 0:4562b55bbb43 319 // dotmatrix.display_pic(step1,green);
wonner163 0:4562b55bbb43 320 //
wonner163 0:4562b55bbb43 321 // }
wonner163 0:4562b55bbb43 322 dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 323 dotmatrix.display_pic(step2,green);
wonner163 0:4562b55bbb43 324 x2=1;
wonner163 0:4562b55bbb43 325 if((ch <=45 and ch >=31) or x3==1)
wonner163 0:4562b55bbb43 326 {
wonner163 0:4562b55bbb43 327 if (stateprint3 == 0){
wonner163 0:4562b55bbb43 328 pc.printf(" pass step3 ");
wonner163 0:4562b55bbb43 329 lcd.cls();
wonner163 0:4562b55bbb43 330 lcd.printf(" pass step3 ");
wonner163 0:4562b55bbb43 331 stateprint3 =1;
wonner163 0:4562b55bbb43 332 //dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 333 // dotmatrix.display_pic(step3,green);
wonner163 0:4562b55bbb43 334
wonner163 0:4562b55bbb43 335 }
wonner163 0:4562b55bbb43 336 dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 337 dotmatrix.display_pic(step3,green);
wonner163 0:4562b55bbb43 338 x3=1;
wonner163 0:4562b55bbb43 339 if((ch <=60 and ch >=46) or x4==1)
wonner163 0:4562b55bbb43 340 {
wonner163 0:4562b55bbb43 341 if (stateprint4 == 0){
wonner163 0:4562b55bbb43 342 pc.printf(" pass step4 ");
wonner163 0:4562b55bbb43 343 lcd.cls();
wonner163 0:4562b55bbb43 344 lcd.printf(" pass step4 ");
wonner163 0:4562b55bbb43 345 stateprint4 =1;
wonner163 0:4562b55bbb43 346
wonner163 0:4562b55bbb43 347 }
wonner163 0:4562b55bbb43 348 dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 349 dotmatrix.display_pic(step4,green);
wonner163 0:4562b55bbb43 350 x4=1;
wonner163 0:4562b55bbb43 351 if((ch <=75 and ch >=61) or x5==1){
wonner163 0:4562b55bbb43 352 if (stateprint5 == 0){
wonner163 0:4562b55bbb43 353 pc.printf(" pass step5 ");
wonner163 0:4562b55bbb43 354 lcd.cls();
wonner163 0:4562b55bbb43 355 lcd.printf(" pass step5 ");
wonner163 0:4562b55bbb43 356 stateprint5 =1;
wonner163 0:4562b55bbb43 357
wonner163 0:4562b55bbb43 358 }
wonner163 0:4562b55bbb43 359 dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 360 dotmatrix.display_pic(step5,green);
wonner163 0:4562b55bbb43 361 x5=1;
wonner163 0:4562b55bbb43 362 if((ch <=90 and ch >=76) or x6==1){
wonner163 0:4562b55bbb43 363 if (stateprint6 == 0){
wonner163 0:4562b55bbb43 364 pc.printf(" pass step6 ");
wonner163 0:4562b55bbb43 365 lcd.cls();
wonner163 0:4562b55bbb43 366 lcd.printf(" pass step6 ");
wonner163 0:4562b55bbb43 367 stateprint6 =1;
wonner163 0:4562b55bbb43 368
wonner163 0:4562b55bbb43 369 }
wonner163 0:4562b55bbb43 370 for (int i = 1; i <= 230; i++)
wonner163 0:4562b55bbb43 371 {
wonner163 0:4562b55bbb43 372
wonner163 0:4562b55bbb43 373 dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 374 dotmatrix.display_pic(step6,green);
wonner163 0:4562b55bbb43 375
wonner163 0:4562b55bbb43 376 }
wonner163 0:4562b55bbb43 377 x6=1;
wonner163 0:4562b55bbb43 378 amount=amount+1;
wonner163 0:4562b55bbb43 379 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 380 if (amount==1){
wonner163 0:4562b55bbb43 381 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 382 lcd.cls();
wonner163 0:4562b55bbb43 383 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 384 for (int i = 1; i <= 230; i++)
wonner163 0:4562b55bbb43 385 {
wonner163 0:4562b55bbb43 386 dotmatrix.display_pic(one,green);
wonner163 0:4562b55bbb43 387 }
wonner163 0:4562b55bbb43 388 }
wonner163 0:4562b55bbb43 389
wonner163 0:4562b55bbb43 390 if (amount==2){
wonner163 0:4562b55bbb43 391 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 392 lcd.cls();
wonner163 0:4562b55bbb43 393 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 394 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 395 dotmatrix.display_pic(two,green);
wonner163 0:4562b55bbb43 396 }
wonner163 0:4562b55bbb43 397 }
wonner163 0:4562b55bbb43 398
wonner163 0:4562b55bbb43 399 if (amount==3){
wonner163 0:4562b55bbb43 400 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 401 lcd.cls();
wonner163 0:4562b55bbb43 402 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 403 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 404 dotmatrix.display_pic(three,green);
wonner163 0:4562b55bbb43 405 }
wonner163 0:4562b55bbb43 406 }
wonner163 0:4562b55bbb43 407
wonner163 0:4562b55bbb43 408 if (amount==4){
wonner163 0:4562b55bbb43 409 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 410 lcd.cls();
wonner163 0:4562b55bbb43 411 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 412 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 413 dotmatrix.display_pic(four,green);
wonner163 0:4562b55bbb43 414 }
wonner163 0:4562b55bbb43 415 }
wonner163 0:4562b55bbb43 416
wonner163 0:4562b55bbb43 417 if (amount==5){
wonner163 0:4562b55bbb43 418 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 419 lcd.cls();
wonner163 0:4562b55bbb43 420 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 421 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 422 dotmatrix.display_pic(five,green);
wonner163 0:4562b55bbb43 423 }
wonner163 0:4562b55bbb43 424 }
wonner163 0:4562b55bbb43 425
wonner163 0:4562b55bbb43 426 if (amount==6){
wonner163 0:4562b55bbb43 427 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 428 lcd.cls();
wonner163 0:4562b55bbb43 429 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 430 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 431 dotmatrix.display_pic(six,green);
wonner163 0:4562b55bbb43 432 }
wonner163 0:4562b55bbb43 433 }
wonner163 0:4562b55bbb43 434
wonner163 0:4562b55bbb43 435 if (amount==7){
wonner163 0:4562b55bbb43 436 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 437 lcd.cls();
wonner163 0:4562b55bbb43 438 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 439 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 440 dotmatrix.display_pic(seven,green);
wonner163 0:4562b55bbb43 441 }
wonner163 0:4562b55bbb43 442 }
wonner163 0:4562b55bbb43 443
wonner163 0:4562b55bbb43 444 if (amount==8){
wonner163 0:4562b55bbb43 445 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 446 lcd.cls();
wonner163 0:4562b55bbb43 447 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 448 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 449 dotmatrix.display_pic(eight,green);
wonner163 0:4562b55bbb43 450 }
wonner163 0:4562b55bbb43 451 }
wonner163 0:4562b55bbb43 452
wonner163 0:4562b55bbb43 453 if (amount==9){
wonner163 0:4562b55bbb43 454 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 455 lcd.cls();
wonner163 0:4562b55bbb43 456 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 457 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 458 dotmatrix.display_pic(nine,green);
wonner163 0:4562b55bbb43 459 }
wonner163 0:4562b55bbb43 460 }
wonner163 0:4562b55bbb43 461
wonner163 0:4562b55bbb43 462 if (amount==10){
wonner163 0:4562b55bbb43 463 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 464 lcd.cls();
wonner163 0:4562b55bbb43 465 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 466 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 467 dotmatrix.display_pic(ten,green);
wonner163 0:4562b55bbb43 468 }
wonner163 0:4562b55bbb43 469 }
wonner163 0:4562b55bbb43 470
wonner163 0:4562b55bbb43 471 if (amount==0){
wonner163 0:4562b55bbb43 472 pc.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 473 lcd.cls();
wonner163 0:4562b55bbb43 474 lcd.printf(" amount %d ",amount);
wonner163 0:4562b55bbb43 475 for (int i = 1; i <= 500; i++){
wonner163 0:4562b55bbb43 476 dotmatrix.display_pic(two,green);
wonner163 0:4562b55bbb43 477 }
wonner163 0:4562b55bbb43 478 }
wonner163 0:4562b55bbb43 479 x=0;
wonner163 0:4562b55bbb43 480 x1=0;
wonner163 0:4562b55bbb43 481 x2=0;
wonner163 0:4562b55bbb43 482 x3=0;
wonner163 0:4562b55bbb43 483 x4=0;
wonner163 0:4562b55bbb43 484 x5=0;
wonner163 0:4562b55bbb43 485 x6=0;
wonner163 0:4562b55bbb43 486 stateprint1 = 0;
wonner163 0:4562b55bbb43 487 stateprint2 = 0;
wonner163 0:4562b55bbb43 488 stateprint3 = 0;
wonner163 0:4562b55bbb43 489 stateprint4 = 0;
wonner163 0:4562b55bbb43 490 stateprint5 = 0;
wonner163 0:4562b55bbb43 491 }
wonner163 0:4562b55bbb43 492 }
wonner163 0:4562b55bbb43 493 }
wonner163 0:4562b55bbb43 494 }
wonner163 0:4562b55bbb43 495 }
wonner163 0:4562b55bbb43 496 }
wonner163 0:4562b55bbb43 497 }while(amount != 10);
wonner163 0:4562b55bbb43 498 pc.printf("yeahhhhhhh");
wonner163 0:4562b55bbb43 499 }