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.
Diff: main.cpp
- Revision:
- 0:38649de1d7c1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Nov 18 21:16:35 2020 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+AnalogIn analog_value(A0);
+
+DigitalOut led(LED1);
+
+int main()
+{
+ float meas_r;
+ float meas_v;
+ float R;
+ float T;
+ float k;
+
+ printf("\nTest du Programme a base de potentiometre\n");
+
+ while(1) {
+
+ k = analog_value.read();
+ meas_r = analog_value.read(); // Read the analog input value (value from 0.0 to 1.0 = full ADC conversion range)
+ meas_v = meas_r * 3300; // Converts value in the 0V-3.3V range
+
+ R = (11000)/((1/meas_r)-1);
+ T=(1/((1/298.15)+ (log10(R/10000))/3973))-273.15;
+
+
+
+ // Display values
+ printf("\nmeasure = %f = %.0f C\n", meas_r, meas_v);
+ printf("\ntest %f , %f, %f\n",R,T,k);
+ printf("measure temperature = %f C",T);
+
+ // LED is ON is the value is below 1V
+ if (meas_v < 3300/2) {
+ led = 1; // LED ON
+ } else {
+ led = 0; // LED OFF
+ }
+
+ wait(3.0); // 1 second
+ }
+}