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:a10f79635bf7
diff -r 000000000000 -r a10f79635bf7 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Oct 05 01:11:21 2019 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+//#include "DebounceIn.h"
+
+
+AnalogIn sensor1(p20); // define the hall and temprature sensors
+AnalogIn sensor2(p17);
+Serial pc(USBTX, USBRX);
+
+Timer timer;
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+
+
+int main() {
+ float time;
+ float volt1;
+ float volt2;
+ float temp;
+ timer.start();
+ while(1) {
+ time=timer.read();
+ volt1=sensor1.read()*3.3;
+ temp=-1481 + sqrt( 2.1962*pow(10.0,6.0) + (1.8639-volt1)/(3.88*pow(10.0,-6.0)) );
+ volt2=sensor2.read()*3.3;
+ pc.printf("$TTMPL=%f,%f,%f,%f\r\n",time,volt1,temp,volt2);
+
+ wait(5);
+ }
+}
