STM32 Nucleo F207Z ultrasonic radar. TODO: send the data over the net
Dependencies: HC_SR04_Ultrasonic_Library PinDetect
radar.h@1:b4179d7a5f2c, 2018-06-29 (annotated)
- Committer:
- vhx
- Date:
- Fri Jun 29 08:52:41 2018 +0000
- Revision:
- 1:b4179d7a5f2c
- Parent:
- 0:23a36e52a5fa
Envoi d'une donn?e
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vhx | 0:23a36e52a5fa | 1 | #ifndef _RADAR_H_ |
vhx | 0:23a36e52a5fa | 2 | #define _RADAR_H_ |
vhx | 0:23a36e52a5fa | 3 | // must import HC_SR04_Ultrasonic_Library |
vhx | 0:23a36e52a5fa | 4 | // https://os.mbed.com/components/HC-SR04/ |
vhx | 0:23a36e52a5fa | 5 | #include <ultrasonic.h> |
vhx | 0:23a36e52a5fa | 6 | |
vhx | 0:23a36e52a5fa | 7 | /* Range enum */ |
vhx | 0:23a36e52a5fa | 8 | enum { |
vhx | 0:23a36e52a5fa | 9 | RANGE_NONE=0, |
vhx | 0:23a36e52a5fa | 10 | RANGE_FAR, |
vhx | 0:23a36e52a5fa | 11 | RANGE_MID, |
vhx | 0:23a36e52a5fa | 12 | RANGE_CLOSE, |
vhx | 0:23a36e52a5fa | 13 | RANGE_MAX |
vhx | 0:23a36e52a5fa | 14 | }; |
vhx | 0:23a36e52a5fa | 15 | |
vhx | 0:23a36e52a5fa | 16 | extern void radar(void); |
vhx | 0:23a36e52a5fa | 17 | |
vhx | 0:23a36e52a5fa | 18 | |
vhx | 0:23a36e52a5fa | 19 | /* Globals */ |
vhx | 0:23a36e52a5fa | 20 | // Global position variable |
vhx | 0:23a36e52a5fa | 21 | extern int volatile position; |
vhx | 0:23a36e52a5fa | 22 | //Set the trigger pin to PC_8 and the echo pin to PC_6 |
vhx | 0:23a36e52a5fa | 23 | //have updates every .1 seconds and a timeout after 1 |
vhx | 0:23a36e52a5fa | 24 | //second, and call dist when the distance changes |
vhx | 0:23a36e52a5fa | 25 | extern ultrasonic mu; |
vhx | 0:23a36e52a5fa | 26 | |
vhx | 0:23a36e52a5fa | 27 | extern DigitalOut led1; |
vhx | 0:23a36e52a5fa | 28 | extern DigitalOut led2; |
vhx | 0:23a36e52a5fa | 29 | extern DigitalOut led3; |
vhx | 0:23a36e52a5fa | 30 | |
vhx | 0:23a36e52a5fa | 31 | #endif //_RADAR_H_ |