Junichi Katsu
/
Grove_TiltSensor
GROVE - 傾きセンサ サンプルプログラム
main.cpp@0:5c86cd8bc659, 2013-11-29 (annotated)
- Committer:
- jksoft
- Date:
- Fri Nov 29 07:37:07 2013 +0000
- Revision:
- 0:5c86cd8bc659
Rev1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:5c86cd8bc659 | 1 | #include "mbed.h" |
jksoft | 0:5c86cd8bc659 | 2 | |
jksoft | 0:5c86cd8bc659 | 3 | DigitalOut myled(LED1); |
jksoft | 0:5c86cd8bc659 | 4 | DigitalIn TiltSensor(p5); |
jksoft | 0:5c86cd8bc659 | 5 | |
jksoft | 0:5c86cd8bc659 | 6 | int main() { |
jksoft | 0:5c86cd8bc659 | 7 | while(1) { |
jksoft | 0:5c86cd8bc659 | 8 | if(TiltSensor==1){ |
jksoft | 0:5c86cd8bc659 | 9 | myled = 1; |
jksoft | 0:5c86cd8bc659 | 10 | } else { |
jksoft | 0:5c86cd8bc659 | 11 | myled = 0; |
jksoft | 0:5c86cd8bc659 | 12 | } |
jksoft | 0:5c86cd8bc659 | 13 | wait(0.2); |
jksoft | 0:5c86cd8bc659 | 14 | } |
jksoft | 0:5c86cd8bc659 | 15 | } |