Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 7:562f136c7681
- Parent:
- 6:bb5f989e3425
- Child:
- 8:95f4f470ae28
--- a/main.cpp	Sun Aug 18 16:01:44 2013 +0000
+++ b/main.cpp	Sun Aug 18 16:04:27 2013 +0000
@@ -37,13 +37,7 @@
     #define LCD1 lcd.locate(0, 0);              // LCD line 1.
     #define LCD2 lcd.locate(0,11);              // LCD line 2.
     #define LCD3 lcd.locate(0,22);              // LCD line 3.
-    
-    #define JOYUP     p15
-    #define JOYDOWN   p12
-    #define JOYLEFT   p13
-    #define JOYRIGHT  p16
-    #define JOYCENTER p14
-    
+       
     #define METROMAX       800                  // max. beats per minute.
     #define METROMIN         8                  // min. beats per minute.
     #define UDSAMPLERATE     0.1                // how often to sample U/D joystick.
@@ -58,17 +52,17 @@
 //--global_instances----------------------------//------------------------------ 
     C12832_LCD  lcd;                            // LCD object.
     
-    InterruptIn   iJoyStickUp    (p15);            // 1 if joystick up     pressed.
-    InterruptIn   iJoyStickDown  (p12);            // 1 if joystick down   pressed.
-    InterruptIn   iJoyStickLeft  (p13);
-    InterruptIn   iJoyStickRight (p16);
-    InterruptIn   iJoyStickCenter(p14);            // 1 if joystick middle pressed.
+    InterruptIn   iJoyStickUp    (p15);         // joystick up rising edge.
+    InterruptIn   iJoyStickDown  (p12);         // joystick down rising edge.
+    InterruptIn   iJoyStickLeft  (p13);         // joystick left rising edge.
+    InterruptIn   iJoyStickRight (p16);         // joystick right rising edge.
+    InterruptIn   iJoyStickCenter(p14);         // 1 if joystick middle pressed.
     
-    DigitalOut    dJoyStickUp    (p15);
-    DigitalOut    dJoyStickDown  (p12);
-    DigitalOut    dJoyStickLeft  (p13);
-    DigitalOut    dJoyStickRight (p16);
-    DigitalOut    dJoyStickCenter(p14);
+    DigitalIn    dJoyStickUp    (p15);
+    DigitalIn    dJoyStickDown  (p12);
+    DigitalIn    dJoyStickLeft  (p13);
+    DigitalIn    dJoyStickRight (p16);
+    DigitalIn    dJoyStickCenter(p14);
 
     DigitalOut  led3(LED1);                     // leftmost LED.