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.
Dependencies: mbed
Fork of 05_analog_thermometer by
Revision 0:d5f4c581840b, committed 2015-11-18
- Comitter:
- icserny
- Date:
- Wed Nov 18 15:31:37 2015 +0000
- Commit message:
- First version
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Nov 18 15:31:37 2015 +0000 @@ -0,0 +1,25 @@ +/** 05_analog_thermometer + * Measeures the temperature by using a Microchip MCP9700A + * analog thermometer (parameteres: 10 mV/C, 500 mV offset, VCC= 2.3-5.5V) + * Result is printed to standard output. + * + * Hardware requirements: + * - FRDM-KL25Z board + * - MCP9700A analog thermometer connected to A0 (PTB0) + */ + +#include "mbed.h" + +AnalogIn ain(A0); // Analog input at PTB0 + +int main() +{ + printf("\r\n05_analog_thermometer program\r\n"); + while(1) { + uint16_t raw = ain.read_u16(); // read raw 16-bit data + float voltage = ain.read()*3300; // read voltage in millivolts + float tempC = (voltage -500)/10; // tempereature in Celsius + printf("ADC: 0x%04X voltage: %5.0f temp: %5.1f C\r\n",raw,voltage,tempC); + wait(2); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Nov 18 15:31:37 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11 \ No newline at end of file