HW6 for OCE560

Dependencies:   mbed

Fork of shomberg_hw_5 by Russell Shomberg

Revision:
9:da0b72918880
Child:
11:42914083ac70
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OCE360Input.cpp	Thu Oct 25 18:12:33 2018 +0000
@@ -0,0 +1,35 @@
+/**
+    Temperature Sensor and Switch Read
+    OCE360Input.cpp
+
+    Purpose: Read a switch connected at p7
+             Read a temperature sensor connected at p20
+        
+    @author  Russell Shomberg
+    @created 2018-10-25
+    @revised 2018-10-25
+    @version 0.0
+    
+    Issues:    
+    
+*/ 
+// INCLUDES
+#include "mbed.h"
+#include "OCE360Input.h"
+
+// DEFINES
+#define VREF 3.5
+#define TEMP_CALIBRATION_A 0.01
+#define TEMP_CALIBRATION_B 0
+
+int read_switch(void) {
+    return myswitch;    
+}
+
+float read_sensor(void){
+    return Ain*VREF*1000;    
+}
+
+float convert_mV_to_temp(int sensorVoltage) {
+    return sensorVoltage*TEMP_CALIBRATION_A+TEMP_CALIBRATION_B;
+}