Junichi Katsu
/
Analog_Temp_Sensor
ワークショップ用に公開しているものです。
Fork of Arch_Analog_Thermistor_Blinker by
Diff: main.cpp
- Revision:
- 8:58795209d9c2
- Parent:
- 7:5c2ade6745ae
- Child:
- 9:5a7dca00d87b
--- a/main.cpp Wed Aug 20 07:17:31 2014 +0000 +++ b/main.cpp Sat Nov 14 06:42:28 2015 +0000 @@ -1,9 +1,9 @@ #include "mbed.h" +#include "SoftSerial.h" -AnalogIn thermistor(A1); /* Temperature sensor connected to Analog Grove connector */ +AnalogIn thermistor(dp13); /* Temperature sensor connected to Analog Grove connector */ -DigitalOut tensplaceLED(LED4); /* This led blinks as per tens place of temperature value(in deg C) */ -DigitalOut unitsplaceLED(LED1); /* This led blinks as per units place of temperature value(in deg C) */ +SoftSerial pc(dp10,dp11); int main() { @@ -19,25 +19,7 @@ /* Convert the resistance to temperature using Steinhart's Hart equation */ temperature=(1/((log(resistance/10000.0)/beta) + (1.0/298.15)))-273.15; - units = (int) temperature % 10; - tens = (int) temperature / 10; - - - for(int i=0; i< tens; i++) - { - tensplaceLED = 1; - wait(.200); - tensplaceLED = 0; - wait(.200); - } - - for(int i=0; i< units; i++) - { - unitsplaceLED = 1; - wait(.200); - unitsplaceLED = 0; - wait(.200); - } + pc.printf("temp=%f\r\n",temperature); wait(0.5); }