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: monitor.cpp
- Revision:
- 0:7f0d0acde96b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/monitor.cpp Tue Apr 30 19:35:08 2019 +0000
@@ -0,0 +1,29 @@
+#include "monitor.h"
+
+float get_temp(uint8_t MSB, uint8_t LSB){
+ float data = MSB*256 + LSB;
+ float temp = 100*data/1024;
+ return temp;
+}
+
+float get_volt(uint8_t MSB, uint8_t LSB){
+ float R1 = 30000.0; //onboard resistor 1 value
+ float R2 = 7500.0; //onboard resistor 2 value
+ float data = MSB*256 + LSB;
+ float volt = (3.3*data/1024)/(R2/(R1+R2));
+ return volt;
+}
+
+float get_amps(uint8_t MSB, uint8_t LSB){
+ float data = MSB*256 + LSB;
+ float amps = (3.3*data/1024 - 1.65)/0.066*10;
+ return amps;
+ //return 0;
+}
+
+float get_vibs(uint8_t MSB, uint8_t LSB){
+ float data = MSB*256 + LSB;
+ float vibs = 100*data/1024;
+ return vibs;
+ //return 0;
+}
\ No newline at end of file