Lab that has to do with basic IO on mbed.

Dependencies:   DebounceIn mbed PinDetect

Revision:
46:7775a1ff6915
Parent:
45:6f60aac74257
Child:
47:0efd125c7f2d
--- a/JessesLab1/main.cpp	Thu Jan 21 11:42:33 2016 -0500
+++ b/JessesLab1/main.cpp	Fri Jan 22 01:24:53 2016 +0000
@@ -2,8 +2,10 @@
 #include "mbed.h"
 #include "DebounceIn.h"
 #include "PinDetect.h"
+#include <mpr121.h>
 
-// PinDetecnt light(p8);
+//// Simple LED Lighting using pushbutton
+// PinDetect light(p8);
 // PwmOut led(p21);
 //
 // int main() {
@@ -13,6 +15,7 @@
 //     }
 // }
 
+// 5-way switch test
 BusOut mbedleds(LED1,LED2,LED3,LED4);
 //BusOut/In is faster than multiple DigitalOut/Ins
 
@@ -72,7 +75,7 @@
     return _pins.read();
 }
 
-Nav_Switch myNav( p9, p6, p7, p5, p8); //pin order on Sparkfun breakout
+Nav_Switch myNav( p20, p17, p18, p16, p19); //pin order on Sparkfun breakout
 
 int main()
 {
@@ -84,3 +87,42 @@
         wait(0.02);
     }
 }
+
+
+//// Touch Keypad Demo
+//
+//DigitalOut led1(LED1);
+//DigitalOut led2(LED2);
+//DigitalOut led3(LED3);
+//DigitalOut led4(LED4);
+//// Create the interrupt receiver object on pin 26
+//InterruptIn interrupt(p26);
+//// Setup the i2c bus on pins 9 and 10
+//I2C i2c(p9, p10);
+//// Setup the Mpr121:
+//// constructor(i2c object, i2c address of the mpr121)
+//Mpr121 mpr121(&i2c, Mpr121::ADD_VSS);
+// 
+//// Key hit/release interrupt routine
+//void fallInterrupt() {
+//  int key_code=0;
+//  int i=0;
+//  int value=mpr121.read(0x00);
+//  value +=mpr121.read(0x01)<<8;
+//  // LED demo mod
+//  i=0;
+//  // puts key number out to LEDs for demo
+//  for (i=0; i<12; i++) {
+//  if (((value>>i)&0x01)==1) key_code=i+1;
+//  }
+//  led4=key_code & 0x01;
+//  led3=(key_code>>1) & 0x01;
+//  led2=(key_code>>2) & 0x01;
+//  led1=(key_code>>3) & 0x01;
+//}
+// 
+//int main() {
+//  interrupt.fall(&fallInterrupt);
+//  interrupt.mode(PullUp);
+//  while (1) {}
+//}
\ No newline at end of file