Use accelerometer to interrupt.

Dependencies:   mbed SDFileSystem

Fork of shomberg_hw_7 by Russell Shomberg

Committer:
rshomberg
Date:
Fri Nov 16 19:53:25 2018 +0000
Revision:
28:a59485b1626b
Code compiles. Need to test. Very ugly!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rshomberg 28:a59485b1626b 1 // INCLUDES
rshomberg 28:a59485b1626b 2 #include "mbed.h"
rshomberg 28:a59485b1626b 3 #include "sensors.h"
rshomberg 28:a59485b1626b 4
rshomberg 28:a59485b1626b 5 DigitalIn myswitch(PIN_SWITCH);
rshomberg 28:a59485b1626b 6 AnalogIn aIn(PIN_TEMP_SENSOR);
rshomberg 28:a59485b1626b 7
rshomberg 28:a59485b1626b 8 //int switchPosition;
rshomberg 28:a59485b1626b 9 //int sensorVoltage;
rshomberg 28:a59485b1626b 10 //int sensorTemp;
rshomberg 28:a59485b1626b 11
rshomberg 28:a59485b1626b 12 int readSwitch(void) {
rshomberg 28:a59485b1626b 13 return myswitch;
rshomberg 28:a59485b1626b 14 }
rshomberg 28:a59485b1626b 15
rshomberg 28:a59485b1626b 16 float readTempSensor(void){
rshomberg 28:a59485b1626b 17 return aIn*VREF*1000; // voltage in mV
rshomberg 28:a59485b1626b 18 }
rshomberg 28:a59485b1626b 19
rshomberg 28:a59485b1626b 20 float mvToTemp(float sensorVoltage) {
rshomberg 28:a59485b1626b 21 return sensorVoltage*TEMP_CALIBRATION_A+TEMP_CALIBRATION_B; //temp in deg C
rshomberg 28:a59485b1626b 22 }
rshomberg 28:a59485b1626b 23
rshomberg 28:a59485b1626b 24
rshomberg 28:a59485b1626b 25