mark reilly
/
Counting_Machine_V6
final form
Diff: main.cpp
- Revision:
- 5:cb60f96b36c9
- Parent:
- 4:67766287a6a0
- Child:
- 6:21c45f712206
--- a/main.cpp Tue Nov 06 10:42:39 2018 +0000 +++ b/main.cpp Tue Nov 06 11:11:29 2018 +0000 @@ -13,6 +13,7 @@ //AnalogIn button2(p19); C12832 lcd(p5, p7, p6, p8, p11); +Serial pc(USBTX, USBRX); // USB serial interface /*int main() { @@ -33,6 +34,7 @@ int main() { + 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 @@ -138,17 +140,19 @@ //doing these things for the other coins as well*/ ta = a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]; - lcd.locate(0,0); - lcd.printf("Your total value is %d %c.",ta,char(163)); + //lcd.locate(0,0); + pc.printf("Your total value is %d %c.",ta,char(163)); wait(5); - lcd.cls(); + system("CLS"); - lcd.printf("Please select witch number \nof coins you would like to see."); + pc.printf("Please select witch number \nof coins you would like to see."); wait(5); - lcd.cls(); - lcd.printf("Confirm your choice by using the switch."); + // pc.cls(); + system("CLS"); + pc.printf("Confirm your choice by using the switch."); wait(3); - lcd.cls(); + system("CLS"); + // pc.cls(); /*switch (buttons) { case button1: an = an+1; @@ -173,19 +177,22 @@ { an = 1; } - lcd.cls(); - lcd.printf("Do you want to see the number of %d %c coins?",v[an],char(163)); + //pc.cls(); + system("CLS"); + pc.printf("Do you want to see the number of %d %c coins?",v[an],char(163)); wait(3); //button1 = 0; } if(switch1 == 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 + 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 wait(5); - lcd.cls(); - lcd.printf("If you would like to see other \ntypes of coins as well, please \nuse switch again."); + //lcd.cls(); + system("CLS"); + pc.printf("If you would like to see other \ntypes of coins as well, please \nuse switch again."); wait(5); - lcd.cls(); + system("CLS"); + //lcd.cls(); } }while(switch1 == 1); @@ -203,7 +210,7 @@ //lcd.cls(); - lcd.printf("Please use the switch for finishing process."); + pc.printf("Please use the switch for finishing process."); //wait(4); while(switch1 == 0) { @@ -212,10 +219,12 @@ //{ // if(switch1 == 1) //{ - lcd.cls(); - lcd.printf("Thank you for using 'Coounting Machine'. \nGood Bye. :-)"); + //pc.cls(); + system("CLS"); + pc.printf("Thank you for using 'Coounting Machine'. \nGood Bye. :-)"); wait(5); - lcd.cls(); + system("CLS"); + //pc.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.