V2

Dependencies:   C12832 mbed

Fork of app-board-LCD by Chris Styles

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "C12832.h"
00003 
00004 
00005 C12832 lcd(p5, p7, p6, p8, p11);
00006 
00007 /*int main()
00008 {
00009     int j=0;
00010     lcd.cls();
00011     lcd.locate(0,3);
00012     lcd.printf("mbed application board!");
00013 
00014     while(true) 
00015     {   // this is the third thread
00016         lcd.locate(0,15);
00017         lcd.printf("Counting : %d",j);
00018         j++;
00019         wait(1.0);
00020     }
00021 }*/
00022 
00023 
00024 int main() 
00025 {
00026     int n1=0; //number of 1p coins
00027     float a1=0; //amount of 1p coins
00028     //...
00029     float ta=0; //total amount of all coins
00030     int c=0; //counting variable
00031     //float tm; // token money 
00032     
00033   /*  for(;;)
00034     {
00035        if(LDR1 == 1)
00036        {
00037         a1++;
00038         n1 = a1*0.01;
00039         //wait(0.2); //I don't know if the programm would count a coin twice when we reset the LED immediately because the programm runs faster than the coins fall 
00040         //why is LED1 = 0; a failure?
00041         c = 0;
00042        }
00043        //... other types of coins
00044        c++;
00045        if (c >= 100)//depands how long the programm per cycle needs
00046        {
00047            break;
00048        }
00049     } */
00050        lcd.printf("You have %d coins of 1p \nwhich means you have %d$*ps",a1,n1); // it looks like we have to use only printf and not lcd.printf
00051        wait(5);
00052        lcd.cls();
00053        //doing these things for the other coins as well
00054        
00055        //ta = n1+n2+n5+n10+n20+n50+n100+n200;
00056        lcd.locate(0,0);
00057        lcd.printf("Your total amount is %d",ta);
00058        wait(5);
00059        lcd.cls();
00060        
00061        /*if() //press button or something like that 
00062        {
00063            lcd.printf("Please enter the mount of money you took:");
00064            scanf("%f",&tm);
00065            lcd.printf("%f",tm);
00066            wait(2);
00067            ta = ta-tm;
00068            lcd.printf("Now you have only %f \bx156 left", ta); //\b for one step backword and I guess that x156 for £ //I'm not sure
00069        }*/
00070        
00071     return(0);
00072 }