Dependencies:   mbed

Committer:
ms523
Date:
Tue Feb 09 15:05:33 2010 +0000
Revision:
0:bd5143ec272b

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ms523 0:bd5143ec272b 1 #include "mbed.h"
ms523 0:bd5143ec272b 2 #include "Terminal.h"
ms523 0:bd5143ec272b 3
ms523 0:bd5143ec272b 4 Terminal term(USBTX, USBRX); //Info transmitted to hypertermal via USB
ms523 0:bd5143ec272b 5 int Flag=0, Count=10;
ms523 0:bd5143ec272b 6
ms523 0:bd5143ec272b 7 void Countdown(void){
ms523 0:bd5143ec272b 8 if(Flag==1){
ms523 0:bd5143ec272b 9 Count--;
ms523 0:bd5143ec272b 10
ms523 0:bd5143ec272b 11 if(Count<=0){
ms523 0:bd5143ec272b 12 Flag=0; //Turn off MoveFlag at the end of the move.
ms523 0:bd5143ec272b 13 }
ms523 0:bd5143ec272b 14 term.locate(18,6);
ms523 0:bd5143ec272b 15 term.printf("%d ",Count);
ms523 0:bd5143ec272b 16 }
ms523 0:bd5143ec272b 17 }
ms523 0:bd5143ec272b 18
ms523 0:bd5143ec272b 19 int main() {
ms523 0:bd5143ec272b 20 Ticker Timer_100ms;
ms523 0:bd5143ec272b 21 Timer_100ms.attach(&Countdown, 0.1); //Call Profile every 0.1 seconds
ms523 0:bd5143ec272b 22
ms523 0:bd5143ec272b 23 term.cls(); //Clear the screen (paint red)
ms523 0:bd5143ec272b 24 term.locate(18,5);
ms523 0:bd5143ec272b 25 term.printf("Count: %d ",Count);
ms523 0:bd5143ec272b 26
ms523 0:bd5143ec272b 27 while(1){
ms523 0:bd5143ec272b 28 int Key=term.getc(); //Get the keypad pressed
ms523 0:bd5143ec272b 29 if(Key==0x0D){ //See if it was ENTER
ms523 0:bd5143ec272b 30 Flag=1;
ms523 0:bd5143ec272b 31 }
ms523 0:bd5143ec272b 32 }
ms523 0:bd5143ec272b 33 }