Junichi Katsu
/
Grove_TemperatureSensor
GROVE -温度センサ サンプルプログラム
Revision 0:fe99878e5849, committed 2013-11-29
- Comitter:
- jksoft
- Date:
- Fri Nov 29 07:49:32 2013 +0000
- Commit message:
- Rev1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r fe99878e5849 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Nov 29 07:49:32 2013 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" + +BusOut myleds(LED1, LED2, LED3, LED4); +AnalogIn SoundSensor(p15); + +int main() { + while(1) { + float value = TemperatureSensor; + int ledbit = 0x00; + + if( value > 0.8 ) { + ledbit = 0x0F; + } + else if( value > 0.6 ) { + ledbit = 0x07; + } + else if( value > 0.4 ) { + ledbit = 0x03; + } + else if( value > 0.2 ) { + ledbit = 0x01; + } + else { + ledbit = 0x00; + } + printf("Value = %f\r\n",value); + wait(0.2); + } +}
diff -r 000000000000 -r fe99878e5849 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Nov 29 07:49:32 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file