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