![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
labirent
Dependencies: mbed mbed-STM32F103C8T6 ultrasonic HCSR04
Diff: main.cpp
- Revision:
- 0:b3e42dad6af5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 16 14:33:33 2019 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include "stm32f103c8t6.h" +#include "hcsr04.h" + +HCSR04 sensor(PA_10,PA_9); +DigitalOut led(PB_12); + +int main(){ + while(1){ + long dist=sensor.distance(); + if(dist<20){ + led=1; + }else if(dist>20){ + led=0; + } + } +} +