10/29/20 12:23
Dependencies: mbed DRV2605 HCSR04 HC_SR04_Ultrasonic_Library
Diff: main.cpp
- Revision:
- 3:ab0d9d3ae4d4
- Parent:
- 2:35ef0b31a857
- Child:
- 4:111b818ede8c
diff -r 35ef0b31a857 -r ab0d9d3ae4d4 main.cpp --- a/main.cpp Fri Oct 30 21:03:24 2020 +0000 +++ b/main.cpp Sat Oct 31 18:44:09 2020 +0000 @@ -10,18 +10,21 @@ I2C i2c1(p9, p10); I2C i2c2(p28, p27); -DRV2605 hap1(&i2c1); -DRV2605 hap2(&i2c2); +bool isERM = true; +DRV2605 hap1(i2c1); +DRV2605 hap2(i2c2); + Timeout cycle; - +//ultrasonic mu(p7, p8, .07, 1, &newdist); volatile int half_cycle_time = 1; //two calls to this interrupt routine generates a square wave void toggle_interrupt() { + // getCurrentDistance(0)=distance; if (distance > 10) { hap1.setWaveform(0); hap1.playRtp(10); @@ -53,7 +56,7 @@ } */ //HC-SR04 Sonar module - ultrasonic mu(p7, p8, .07, 1, &newdist); +// ultrasonic mu(p7, p8, .07, 1, &newdist); //Set the trigger pin to p6 and the echo pin to p7 //have updates every .07 seconds and a timeout after 1 //second, and call newdist when the distance changes