Polybot Grenoble / Mbed 2 deprecated Temperature_LM35

Dependencies:   mbed

main.cpp

Committer:
guillaume6544
Date:
2019-03-08
Revision:
0:18e57ab7c8b8

File content as of revision 0:18e57ab7c8b8:

#include "mbed.h"

/*------------------------------------------------------------------------------
Before to use this example, ensure that you an hyperterminal installed on your
computer. More info here: https://developer.mbed.org/handbook/Terminals

The default serial comm port uses the SERIAL_TX and SERIAL_RX pins (see their
definition in the PinNames.h file).

The default serial configuration in this case is 9600 bauds, 8-bit data, no parity

If you want to change the baudrate for example, you have to redeclare the
serial object in your code:

Serial pc(SERIAL_TX, SERIAL_RX);

Then, you can modify the baudrate and print like this:

pc.baud(115200);
pc.printf("Hello World !\n");
------------------------------------------------------------------------------*/

DigitalOut led(LED1);

int main()
{
    AnalogIn LM35(A2);
    float temperature;

    

    while(1) {
        wait(1); // 1 second
        temperature = LM35.read();
        temperature = temperature*3.685503686*100;
        printf("Température =  %f \n\r",temperature);
    }
}