티스토리 뷰
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
- Linux
- Spring MVC
- 송주경
- 서울오토살롱
- 전예희
- ffmpeg
- JavaScript
- NDK
- android
- flex
- koba2010
- ubuntu
- 일본여행
- 튜닝쇼 2008
- 동경
- 레이싱모델 익스트림 포토 페스티벌
- Delphi Tip
- Delphi
- Java
- Mac
- Xcode
- sas2009
- 지스타2007
- ble
- Spring
- MySQL
- SAS
- KOBA
- oracle
- BPI-M4
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함