Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed_blinky by
Revision 7:7032b113e13b, committed 2014-10-22
- Comitter:
- scohennm
- Date:
- Wed Oct 22 01:30:06 2014 +0000
- Parent:
- 6:e8cd76f38fa9
- Commit message:
- Experiment with K20D50M Temperature sensor BD1020HFV Temperature sensor. Sitnal routed from J13 to PTC0
Changed in this revision
diff -r e8cd76f38fa9 -r 7032b113e13b main.cpp --- a/main.cpp Fri May 09 19:58:03 2014 +0300 +++ b/main.cpp Wed Oct 22 01:30:06 2014 +0000 @@ -1,12 +1,45 @@ #include "mbed.h" -DigitalOut myled(LED1); +#define LEDOFF 1 +#define LEDON 0 +#define DATATIME 0.4 +// temp contants +#define REFVOLTS 1.29 +#define REFTEMP 30.0 +#define VDD 3.3 +#define TEMPSLOPE -0.0081 +// Conversion to F +#define CZERO 32.0 +#define CFSLOPE 1.8 + + +Serial pc(USBTX, USBRX); +DigitalOut myRled(LED_RED); +DigitalOut myGled(LED_GREEN); +DigitalOut myBled(LED_BLUE); + +AnalogIn tempSensor(PTC0); // jumper on board J13 left pin to PTC0 J10-2 int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + float rawVolts; + float rawTemp; + float actTemp; //actual temperature + float FTemp; + int LEDState = LEDON; + + myBled.write(LEDOFF); + myGled.write(LEDOFF); + while(true) { + + rawTemp = tempSensor.read();//actually percentatd of Vdd volts + rawVolts = VDD * rawTemp; + actTemp = REFTEMP + (rawVolts - REFVOLTS)/TEMPSLOPE; + FTemp = CZERO + actTemp*CFSLOPE; + pc.printf("RawTemp = %f Actual Ctemp = %5.2f Ftemp = %5.2f\r\n", rawTemp, actTemp, FTemp); + + myRled.write(LEDState); + LEDState = !LEDState; + wait(DATATIME); + } }
diff -r e8cd76f38fa9 -r 7032b113e13b mbed.bld --- a/mbed.bld Fri May 09 19:58:03 2014 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file
diff -r e8cd76f38fa9 -r 7032b113e13b mbed.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.lib Wed Oct 22 01:30:06 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/#552587b429a1