University of Plymouth - Stages 1, 2 and 3 / Mbed OS Task325-FZ429
Revision:
4:684525c93d74
Parent:
3:52ced27ad588
Child:
5:c11d12dab1e2
--- a/main.cpp	Tue Feb 06 12:42:56 2018 +0000
+++ b/main.cpp	Thu Sep 12 13:57:55 2019 +0000
@@ -4,24 +4,34 @@
 // However, pressing and releasing the switch can result in spurious falling edges
 // which trigger the routine 
 
+//Uncomment this if you want to use the onboard LEDs and Blue Switch on a F429ZI
+#define USEONBOARD
+
 //Declare functions
 void sw1FallingEdge();
 
 //Global Objects
+#ifdef USEONBOARD
 DigitalOut  red_led(LED3);
-DigitalOut  yellow_led(LED2);
 DigitalOut  green_led(LED1);
-InterruptIn   sw1(USER_BUTTON);
+InterruptIn sw1(USER_BUTTON);
+#else
+DigitalOut  red_led(D7);
+DigitalOut  green_led(D5);
+InterruptIn sw1(D4);
+#endif
 
 //Interrupt service routine for a rising edge (press)
 void sw1FallingEdge() {
     red_led = !red_led;     //Toggle the LED
 }
 
+Serial pc(USBTX, USBRX);
+
 //Main - only has to initialise and sleep
 int main() {
-    //Initial logging message
-    puts("START");
+
+    pc.set_blocking(true);
     red_led   = 0;
     green_led = 1;
     
@@ -35,7 +45,10 @@
         sleep();
         
         //You can ONLY reach this point if an ISR wakes the CPU
-        puts("ISR just woke the MPU");
+        green_led = !green_led;
+        
+        //Any use of the serial port will produce a series of interrupts
+        //pc.puts("Ping!\n\r");
         
     } //end while