mark reilly
/
Counting_Machine_V5
final form
Revision 8:f047d0a8a18c, committed 2018-11-26
- Comitter:
- mark1998
- Date:
- Mon Nov 26 15:07:23 2018 +0000
- Parent:
- 7:b522dd5a5d39
- Commit message:
- V5
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b522dd5a5d39 -r f047d0a8a18c main.cpp --- a/main.cpp Thu Nov 22 12:23:46 2018 +0000 +++ b/main.cpp Mon Nov 26 15:07:23 2018 +0000 @@ -34,7 +34,7 @@ int main() { - pc.baud(921600); + //pc.baud(921600); float a[8]={0,0,0,0,0,0,0,0}; //number of 1p coins int n[8]={0,0,0,0,0,0,0,0}; //amount of 1p coins float v[8]={0.01,0.02,0.05,0.1,0.2,0.5,1,2};// value of coins @@ -142,18 +142,21 @@ ta = a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]; //lcd.locate(0,0); //pc.printf("Your total value is %d %c.",ta,char(163)); - pc.printf( "your total value is %f %c.",ta,char(163)); + lcd.locate(0,0); + lcd.printf( "your total value is %f %c.",ta,char(163)); wait(5); - system("CLS"); + //system("CLS"); + lcd.cls(); - pc.printf("Please select witch number \nof coins you would like to see."); + lcd.locate(0,0); + lcd.printf("Please select witch number \nof coins you would like to see."); wait(5); - // pc.cls(); - system("CLS"); + lcd.cls(); + //system("CLS"); pc.printf("Confirm your choice by using the switch."); wait(3); - system("CLS"); - // pc.cls(); + //system("CLS"); + lcd.cls(); /*switch (buttons) { case button1: an = an+1; @@ -183,8 +186,10 @@ - system("CLS"); - pc.printf("Do you want to see the number of %d %c coins?",v[an],char(163)); + //system("CLS"); + lcd.cls(); + lcd.locate(0,0); + lcd.printf("Do you want to see the number of %d %c coins?",v[an],char(163)); an++; if (an > 7); { @@ -195,14 +200,17 @@ } if(switch1 == 0) { - pc.printf("You have %d of this type of coins. \nThat means you have %f %c of this type of coin.",n[an],a[an],char(163)); //it doesn't know button1 and button2 yet + lcd.locate(0,0); + lcd.printf("You have %d of this type of coins. \nThat means you have %f %c of this type of coin.",n[an],a[an],char(163)); //it doesn't know button1 and button2 yet wait(5); - //lcd.cls(); - system("CLS"); - pc.printf("If you would like to see other \ntypes of coins as well, please \nuse switch again."); + + lcd.cls(); + //system("CLS"); + lcd.locate(0,0); + lcd.printf("If you would like to see other \ntypes of coins as well, please \nuse switch again."); wait(5); - system("CLS"); - //lcd.cls(); + //system("CLS"); + lcd.cls(); } }while(switch1 == 1); @@ -219,8 +227,8 @@ //wait(5); //lcd.cls(); - - pc.printf("Please use the switch for finishing process."); + lcd.locate(0,0); + lcd.printf("Please use the switch for finishing process."); //wait(4); while(switch1 == 0) { @@ -229,12 +237,13 @@ //{ // if(switch1 == 1) //{ - //pc.cls(); - system("CLS"); - pc.printf("Thank you for using 'Coounting Machine'. \nGood Bye. :-)"); + lcd.cls(); + //system("CLS"); + lcd.locate(0,0); + lcd.printf("Thank you for using 'Coounting Machine'. \nGood Bye. :-)"); wait(5); - system("CLS"); - //pc.cls(); + //system("CLS"); + lcd.cls(); //} //}while (switch1 == 0); /*if() //press button or something like that //total amount which is left when the user took money and entered the amount of it in the machine.