![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
tes ir atas semua
Dependencies: mbed ADS1115 StepperMotor SRF05 TPA81new
Diff: main.cpp
- Revision:
- 37:f0b535131cbf
- Parent:
- 28:528c2fbd6a54
- Child:
- 38:fea0806e214a
--- 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"); } }