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.
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Revision 5:c48d1e7b3b64, committed 2019-09-10
- Comitter:
- IslamKhalil
- Date:
- Tue Sep 10 08:14:32 2019 +0000
- Parent:
- 2:cd67be02b1f7
- Commit message:
- LEDs and Switches and serial communication
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file | 
--- a/main.cpp	Mon Sep 09 09:56:42 2019 +0000
+++ b/main.cpp	Tue Sep 10 08:14:32 2019 +0000
@@ -5,19 +5,33 @@
 #include "BiQuad.h"
 #include "FastPWM.h"
 
-DigitalOut led(LED_BLUE);
-
-MODSERIAL pc(USBTX, USBRX);
+DigitalOut led1(LED_RED) ;
+DigitalOut led2(LED_BLUE) ;
+MODSERIAL pc(USBTX, USBRX) ;
+DigitalIn sw2(SW2) ;
+DigitalIn sw3(SW3) ;
 
 int main()
 {
     pc.baud(115200);
     pc.printf("\r\nStarting...\r\n\r\n");
     
-    while (true) {
-        
-        led = !led;
-        
-        wait_ms(1000);
+    while (true) 
+    {
+        if (sw2 == false)
+        {
+            led1 = 0 ;
+            pc.printf("\r\nSW2 is ON...\r\n\r\n") ;
+        }
+        if (sw3 == false)
+        {
+            led2 = 0 ;
+            pc.printf("\r\nSW3 is ON...\r\n\r\n") ;
+        }
+        else if ((sw2 == true) && (sw3 == true))
+        {
+            led1 = 1 ;
+            led2 = 1 ;
+        }
     }
 }