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.
Revision 0:a0cba8c797e8, committed 2019-10-22
- Comitter:
- brunostgr
- Date:
- Tue Oct 22 13:40:12 2019 +0000
- Commit message:
- q6
Changed in this revision
| Question6.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Question6.cpp Tue Oct 22 13:40:12 2019 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+
+AnalogIn analog_value(PA_0);
+
+I2C i2c(I2C_SDA,I2C_SCL);
+Serial PC(USBTX, USBRX);
+
+// Programme principal
+int main()
+{
+ // Declaration des variables
+ float mesure;
+ float temp;
+ char nb[1]; // Tableau de donnees
+ const int POT = 0xA9; // Adresse du potentiometre
+
+ while(1) {
+
+ // Conversion
+ mesure = analog_value.read(); // Assigne une valeur de 0.0 à 1.0 a mesure
+ temp = mesure * 330; // Conversion en degres Celsius
+
+ // Affichage de la temperature
+ PC.printf("Temperature = %u C",(unsigned)temp);
+
+ // Envoi au pot
+ nb[0] = 256 * mesure;
+ i2c.write(POT,nb,1,0);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 22 13:40:12 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file