Uploading sensor data (voltage divider, MAX4172, INA219) over Ethernet to Thing Speak service. Uses old mbed revision that is compatible with NetServices library. I2C communication is made with I2CR library.

Dependencies:   C12832 I2CR INA219 NetServices mbed

Fork of NetServices_HelloWorld by Segundo Equipo

Committer:
tsoic
Date:
Sun Nov 29 13:41:05 2015 +0000
Revision:
7:1da0a084cd69
Parent:
6:ebbde59c5a1d
Child:
8:9b35ac104ab7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tsoic 7:1da0a084cd69 1 /** Simple class for sensor with linear otuput. Made for later upgrading, to avarage values from ADC
tsoic 7:1da0a084cd69 2 * Example:
tsoic 7:1da0a084cd69 3 * @code
tsoic 7:1da0a084cd69 4 * #include "mbed.h"
tsoic 7:1da0a084cd69 5 * #include "Sensor.h"
tsoic 7:1da0a084cd69 6 * #include "INA219_reg.h"
tsoic 7:1da0a084cd69 7 *
tsoic 7:1da0a084cd69 8 * Sensor voltageDivider(p20,5);
tsoic 7:1da0a084cd69 9 * float value;
tsoic 7:1da0a084cd69 10 *
tsoic 7:1da0a084cd69 11 * int main() {
tsoic 7:1da0a084cd69 12 * value = voltageDivider.read();
tsoic 7:1da0a084cd69 13 * }
tsoic 7:1da0a084cd69 14 * @endcode
tsoic 7:1da0a084cd69 15
tsoic 7:1da0a084cd69 16 */
tsoic 6:ebbde59c5a1d 17 #ifndef _SENSOR_H
tsoic 6:ebbde59c5a1d 18 #define SENSOR_H
tsoic 6:ebbde59c5a1d 19 #include "mbed.h"
tsoic 6:ebbde59c5a1d 20
tsoic 6:ebbde59c5a1d 21 class Sensor {
tsoic 6:ebbde59c5a1d 22
tsoic 6:ebbde59c5a1d 23 public:
tsoic 7:1da0a084cd69 24 /**
tsoic 7:1da0a084cd69 25 * @param: PinName of ADC to which sensor is connected
tsoic 7:1da0a084cd69 26 * float value for multiplifing with raw value from ADC to get real value
tsoic 7:1da0a084cd69 27 */
tsoic 7:1da0a084cd69 28 Sensor(PinName, float);
tsoic 7:1da0a084cd69 29 /** Read real messured value
tsoic 7:1da0a084cd69 30 * return: float real messured value
tsoic 7:1da0a084cd69 31 *
tsoic 7:1da0a084cd69 32 **/
tsoic 7:1da0a084cd69 33 float read();
tsoic 7:1da0a084cd69 34
tsoic 6:ebbde59c5a1d 35 private:
tsoic 6:ebbde59c5a1d 36
tsoic 6:ebbde59c5a1d 37 AnalogIn sensorInput;
tsoic 6:ebbde59c5a1d 38 float readVal[], realVal, K;
tsoic 6:ebbde59c5a1d 39 };
tsoic 6:ebbde59c5a1d 40
tsoic 6:ebbde59c5a1d 41 #endif