フォトセンサのサンプルプログラム
Dependencies: mbed
main.cpp@0:76eb7afb3f57, 2019-07-29 (annotated)
- Committer:
- GGU
- Date:
- Mon Jul 29 06:28:39 2019 +0000
- Revision:
- 0:76eb7afb3f57
photo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GGU | 0:76eb7afb3f57 | 1 | #include "mbed.h" |
GGU | 0:76eb7afb3f57 | 2 | |
GGU | 0:76eb7afb3f57 | 3 | AnalogIn photo(A4); |
GGU | 0:76eb7afb3f57 | 4 | Serial pc(USBTX,USBRX); |
GGU | 0:76eb7afb3f57 | 5 | |
GGU | 0:76eb7afb3f57 | 6 | |
GGU | 0:76eb7afb3f57 | 7 | |
GGU | 0:76eb7afb3f57 | 8 | int main(){ |
GGU | 0:76eb7afb3f57 | 9 | while(1){ |
GGU | 0:76eb7afb3f57 | 10 | pc.printf("%f\t",photo.read()); //センサから得たデータを出力 |
GGU | 0:76eb7afb3f57 | 11 | wait(1); //1sec |
GGU | 0:76eb7afb3f57 | 12 | } |
GGU | 0:76eb7afb3f57 | 13 | } |
GGU | 0:76eb7afb3f57 | 14 |