티스토리 뷰
728x90
출처 : Steve136/microbit-ultrasonic: Example usage of a HC-SR04 Ultrasonic Sensor and the BBC Micro:Bit.
HCSR04 - Ultrasound Ranging Sensor module | Mbed
micro:bit - 초음파 거리센서(HC-SR04)
소스
#include "MicroBit.h" #include "hcsr04.h" MicroBit uBit; HCSR04 usensor(P0_3, P0_2); // TRIGGER, ECHO unsigned int dist; int main() { uBit.init(); uBit.display.scroll("init", 70); while(1) { usensor.start(); wait_ms(500); dist = usensor.get_dist_cm(); char buf[100]; sprintf (buf, "d:%d", dist); uBit.display.scroll(buf, 70); wait(1.0); // 1 sec } }
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 서울오토살롱
- 송주경
- JavaScript
- Mac
- KOBA
- Spring MVC
- oracle
- ffmpeg
- ble
- koba2010
- 튜닝쇼 2008
- Linux
- Delphi Tip
- ubuntu
- SAS
- 동경
- Xcode
- Delphi
- MySQL
- 일본여행
- 레이싱모델 익스트림 포토 페스티벌
- NDK
- sas2009
- Java
- android
- 지스타2007
- 전예희
- BPI-M4
- Spring
- flex
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
글 보관함