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.
Fork of MPR121_HelloWorld by
Revision 2:383e257538ff, committed 2014-08-15
- Comitter:
 - sam_grove
 - Date:
 - Fri Aug 15 23:04:24 2014 +0000
 - Parent:
 - 1:684222fa16bb
 - Commit message:
 - Initial commit
 
Changed in this revision
diff -r 684222fa16bb -r 383e257538ff MPR121.lib --- a/MPR121.lib Tue Aug 27 21:43:28 2013 +0000 +++ b/MPR121.lib Fri Aug 15 23:04:24 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/sam_grove/code/MPR121/#828260f21de6 +http://mbed.org/users/sam_grove/code/MPR121/#b6bb38744edd
diff -r 684222fa16bb -r 383e257538ff main.cpp
--- a/main.cpp	Tue Aug 27 21:43:28 2013 +0000
+++ b/main.cpp	Fri Aug 15 23:04:24 2014 +0000
@@ -1,36 +1,20 @@
 #include "mbed.h"
 #include "MPR121.h"
 
-Serial pc(USBTX, USBRX);
-DigitalOut myled(LED1);
-
-#if defined TARGET_LPC1768 || TARGET_LPC11U24
-  I2C i2c(p28, p27);
-  InterruptIn irq(p26);
-  MPR121 touch_pad(i2c, irq, MPR121::ADDR_VSS);
-
-#elif defined TARGET_KL25Z
-  I2C i2c(PTC9, PTC8);
-  InterruptIn irq(PTA5);
-  MPR121 touch_pad(i2c, irq, MPR121::ADDR_VSS);
-
-#else
-  #error TARGET NOT TESTED
-#endif
+I2C i2c(D14, D15);
+MPR121 touch_pad(i2c, MPR121::ADDR_VSS);
 
 int main() 
 {       
+    uint16_t button_val = 0;
+    
     touch_pad.init();
     touch_pad.enable();
-    touch_pad.registerDump(pc);
     
     while(1)
     {
-        if(touch_pad.isPressed())
-        {
-            uint16_t button_val = touch_pad.buttonPressed();
-            printf("button = 0x%04x\n", button_val);
-            myled = (button_val>0) ? 1 : 0;
-        }            
+        button_val = touch_pad.buttonPressed();
+        printf("button = 0x%04x\n", button_val);
+        wait(0.1f);
     }
 }
diff -r 684222fa16bb -r 383e257538ff mbed.bld --- a/mbed.bld Tue Aug 27 21:43:28 2013 +0000 +++ b/mbed.bld Fri Aug 15 23:04:24 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/9c8f0e3462fb \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file

            Grove Touch Sensor