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.
main.cpp
- Committer:
- hample
- Date:
- 2019-01-08
- Revision:
- 0:91a5544963d7
File content as of revision 0:91a5544963d7:
#include "mbed.h"
using namespace std;
AnalogIn read_temp(PD4);
float temp;
uint16_t temp_hex;
float temp_volt;
float temp_ambient;
int main()
{
while(1)
{
temp = read_temp.read();
temp_hex = read_temp.read_u16();
temp_volt = temp*3.3;
temp_ambient = (temp_volt - 0.5)/0.01;
//printf("%f \r\n", temp);
printf("Hex: 0x%04X \r\n", temp_hex);
printf("Voltage in: %.2f \r\n", temp_volt);
printf("Ambient temperature: %.2f \r\n", temp_ambient);
wait(1);
}
}
// 0.739