hisyam fs / Mbed 2 deprecated Test_all

Dependencies:   mbed ADS1115 StepperMotor SRF05 TPA81new

Files at this revision

API Documentation at this revision

Comitter:
hisyamfs
Date:
Thu Feb 07 12:05:16 2019 +0000
Parent:
28:528c2fbd6a54
Child:
38:fea0806e214a
Commit message:
+LED

Changed in this revision

TPA81new.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TPA81new.lib	Thu Jan 24 10:35:36 2019 +0000
+++ b/TPA81new.lib	Thu Feb 07 12:05:16 2019 +0000
@@ -1,1 +1,1 @@
-TPA81new#90ed652031fd
+https://os.mbed.com/users/hisyamfs/code/TPA81new/#90ed652031fd
--- a/main.cpp	Thu Jan 24 10:35:36 2019 +0000
+++ b/main.cpp	Thu Feb 07 12:05:16 2019 +0000
@@ -50,6 +50,9 @@
 AnalogIn irb3(PA_4);
 AnalogIn irb4(PB_0);
 
+DigitalOut led_api(PH_0);
+DigitalOut led_sound(PH_1);
+
 float call_depan(uint16_t x){
     float side_distance = a_depan/pow(x,b_depan)+1;
     return side_distance;
@@ -58,7 +61,9 @@
 int main()
 {
     //tpax.changeaddress(0xDC,0xDE);
-    while(sound.read()){}
+//    while(sound.read()){}
+    led_api = 0;
+    led_sound = 0;
     pc.printf("Sound Detected\n");
     while(1) {
         pc.printf("%d", tpay.getTemp(0));
@@ -130,5 +135,20 @@
         pc.printf("      %.2f\n", dist_b1);
         pc.printf("%.2f            %.2f\n", dist_b2, dist_b3);
         pc.printf("      %.2f\n", dist_b4);
+        
+        wait(1);
+        
+        led_api = 1;
+        pc.printf("led api on");
+        wait(0.2);
+        led_api = 0;
+        pc.printf("led api off");
+        
+        led_sound = 1;
+        pc.printf("led sound on");
+        wait(0.2);
+        led_sound = 0;
+        pc.printf("led sound off");
+        pc.printf("\033[2J\033[H");
     }
 }