Fully integrated working system
Dependencies: Speaker mbed mbed-rtos 4DGL-uLCD-SE hcsr04
main.cpp
- Committer:
- tadhgjones
- Date:
- 2020-12-16
- Revision:
- 8:f3ab61374cd0
- Child:
- 9:d1b00a2a8e25
File content as of revision 8:f3ab61374cd0:
#include "mbed.h" #include "hcsr04.h" #include "Speaker.h" HCSR04 usensor(p25,p6); Serial pc(USBTX, USBRX); Speaker mySpeaker(p18); unsigned int dist; int main() { while(1) { usensor.start(); wait_ms(50); dist=usensor.get_dist_cm(); mySpeaker.PlayNote(329.63, 0.5, 1.0); pc.printf("cm:%ld\n",dist ); } }