would be Simon game, as a demonstrator for buttons debouncing and \"collecting\" ---

Revision:
2:fe450a70f8a4
Parent:
1:3acf57259c58
--- a/main_basic.cpp	Mon Dec 13 23:51:43 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-#include "mbed.h"
-#include "DebounceIn_.h"
-#include <stdbool.h>
-
-DebounceIn button1(p15);
-DebounceIn button2(p16);
-DebounceIn button3(p17);
-DebounceIn button4(p21);
-
-class CSimonButton {
-    _Bool pressed;
-    int button;
-  public:
-          CSimonButton();
-    _Bool IsPressed(void);
-    int   GetButton(void) {return button;};
-    void  Handle(void);
-};
-
-CSimonButton::CSimonButton() {
-    button1.mode(PullUp);
-    button2.mode(PullUp);
-    button3.mode(PullUp);
-    button4.mode(PullUp);
-  pressed = 0;
-}
-
-_Bool CSimonButton::IsPressed(void) {
-  _Bool tmp;
-  
-  tmp = pressed;
-  pressed = 0;
-  return tmp;
-}
-
-void CSimonButton::Handle(void) {
-      if  (button1.pressed) {
-        button1.pressed = 0;
-        pressed = 1;
-        button = 1;
-      }
-      if  (button2.pressed) {
-        button2.pressed = 0;
-        pressed = 1;
-        button = 2;
-      }
-      if  (button3.pressed) {
-        button3.pressed = 0;
-        pressed = 1;
-        button = 3;
-      }
-      if  (button4.pressed) {
-        button4.pressed = 0;
-        pressed = 1;
-        button = 4;
-      }
-  
-}
-
-
-uint8_t ledState;
-
-BusOut leds(LED1, LED2, LED3, LED4);
-
-int main() {
-    CSimonButton simonButton;
-    while (1) {
-      leds.write(ledState); 
-      simonButton.Handle();
-      
-      if (simonButton.IsPressed()) {
-        ledState ^= 1 << (simonButton.GetButton() - 1);
-      }
-    }
-}
-/*
-int main() {
-    while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
-    }
-}
-*/
\ No newline at end of file