![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
k
Dependencies: mbed
main2.cpp
00001 #include "mbed.h" 00002 00003 AnalogIn analog_value(A0); // Définition broche analogique sur PA_0 00004 Serial pc(SERIAL_TX, SERIAL_RX); // Définition d'un port série avec l'ordinateur 00005 Ticker printTMP; // Définition d'un ticker 00006 00007 uint8_t tmp = 0; // Définition variable tmp; GLOBAL; tmp = Température 00008 00009 void print(){ 00010 pc.printf("Temperature = %u C", tmp); // Affiche tmp/température 00011 } 00012 00013 int main() { 00014 printTMP.attach(&print, 0.2); 00015 00016 while(1) { 00017 int16_t meas = analog_value.read() * 3300; // Lecture du port analogique 00018 tmp = (uint8_t)(((float)meas / 10) - 273.15); // mV --> °C 00019 } 00020 }
Generated on Wed Jul 20 2022 08:38:13 by
![doxygen](doxygen.png)