Nabila Bilqisti
/
STM32_Print_PC
PERSONAL USE ONLY
main.cpp
- Committer:
- JinxedJinx
- Date:
- 2018-08-01
- Revision:
- 0:5edc821273af
File content as of revision 0:5edc821273af:
#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); #include "DHT11.h" DHT11 d(D8); int main() { int s; int hum=0,tem=0; printf("Hello World !\n"); while(1) { wait(1); // 1 second s=d.readData(); hum=d.readHumidity(); tem=d.readTemperature(); printf("Tem = %d Hum = %d\n", tem,hum); } } */ DigitalOut led(LED1); #include "DHT.h" DHT d(D8,11); int main() { int s; float hum=0,tem=0; printf("Hello World !\n"); while(1) { wait(1); // 1 second s=d.readData(); hum=d.ReadHumidity(); tem=d.ReadTemperature(KELVIN); tem=tem-273; printf("Tem = %.2f Hum = %.2f\n", tem,hum); } }