Сбор информации о погодных условиях

Dependencies:   RF24 USBDevice mbed

Committer:
pro100kot14
Date:
Sat Dec 05 16:57:30 2015 +0000
Revision:
6:db4538895ae7
Parent:
4:7cd67d988145
Added unit testing. Test results are displayed on the device LEDs.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pro100kot14 2:ad2653bcf93f 1 #ifndef PHOTORESISTOR_H
pro100kot14 2:ad2653bcf93f 2 #define PHOTORESISTOR_H
pro100kot14 2:ad2653bcf93f 3
pro100kot14 2:ad2653bcf93f 4 #include "mbed.h"
pro100kot14 2:ad2653bcf93f 5 #include "Illumination.h"
pro100kot14 2:ad2653bcf93f 6 /**
pro100kot14 2:ad2653bcf93f 7 * Reads the resistance of photoresistor and associates it with
pro100kot14 2:ad2653bcf93f 8 * the light level of illumination provided by enum Illumination.
pro100kot14 2:ad2653bcf93f 9 */
pro100kot14 2:ad2653bcf93f 10 class Photoresistor{
pro100kot14 2:ad2653bcf93f 11 public:
pro100kot14 2:ad2653bcf93f 12 /**
pro100kot14 2:ad2653bcf93f 13 * Constructor
pro100kot14 2:ad2653bcf93f 14 *
pro100kot14 2:ad2653bcf93f 15 * @param inputChanel The analog input is connected to the photoresistor
pro100kot14 2:ad2653bcf93f 16 */
pro100kot14 2:ad2653bcf93f 17 Photoresistor(AnalogIn inputChanel);
pro100kot14 2:ad2653bcf93f 18
pro100kot14 2:ad2653bcf93f 19 /**
pro100kot14 2:ad2653bcf93f 20 * Level of illumination provided by enum Illumination
pro100kot14 2:ad2653bcf93f 21 *
pro100kot14 2:ad2653bcf93f 22 * @returns Level of illumination
pro100kot14 2:ad2653bcf93f 23 */
pro100kot14 2:ad2653bcf93f 24 Illumination getIllumination();
pro100kot14 6:db4538895ae7 25
pro100kot14 6:db4538895ae7 26 /**
pro100kot14 6:db4538895ae7 27 * Level of illumination provided by enum Illumination.
pro100kot14 6:db4538895ae7 28 * Сomfortably for testing.
pro100kot14 6:db4538895ae7 29 *
pro100kot14 6:db4538895ae7 30 * @param adcVal ADC value on the port to which the sensor is connected
pro100kot14 6:db4538895ae7 31 *
pro100kot14 6:db4538895ae7 32 * @returns Level of illumination
pro100kot14 6:db4538895ae7 33 */
pro100kot14 6:db4538895ae7 34 static Illumination getIlluminationByAdcValue(float adcVal);
pro100kot14 2:ad2653bcf93f 35
pro100kot14 2:ad2653bcf93f 36 private:
pro100kot14 2:ad2653bcf93f 37 AnalogIn input;
pro100kot14 2:ad2653bcf93f 38 };
pro100kot14 2:ad2653bcf93f 39
pro100kot14 6:db4538895ae7 40 /**
pro100kot14 6:db4538895ae7 41 * Tested the class Photoresistor
pro100kot14 6:db4538895ae7 42 */
pro100kot14 6:db4538895ae7 43 class PhotoresistorTest{
pro100kot14 6:db4538895ae7 44 public:
pro100kot14 6:db4538895ae7 45 static bool adcValue_0_isDark();
pro100kot14 6:db4538895ae7 46 static bool adcValue_0_009_isDark();
pro100kot14 6:db4538895ae7 47 static bool adcValue_0_34_isVeryCloudly();
pro100kot14 6:db4538895ae7 48 static bool adcValue_0_93_isCloudly();
pro100kot14 6:db4538895ae7 49 static bool adcValue_0_97_isClear();
pro100kot14 6:db4538895ae7 50 static bool adcValue_0_98_isVerySunny();
pro100kot14 6:db4538895ae7 51 };
pro100kot14 6:db4538895ae7 52
pro100kot14 2:ad2653bcf93f 53 #endif