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.
Dependencies: SDFileSystem WIZnetInterface mbed
readsensor.cpp
00001 /* 00002 * readsensor.cpp 00003 * 00004 * 00005 */ 00006 00007 00008 #include "mbed.h" 00009 #include <stdint.h> 00010 00011 /** Read all sensors and store them in a virtual filesystem 00012 * 00013 * @code 00014 * #include "mbed.h" 00015 * #include "readsensor.h" 00016 * 00017 * ReadSensor sensorRead(); // 00018 * 00019 * 00020 * } 00021 * @endcode 00022 */ 00023 00024 DigitalOut myled(LED1); 00025 AnalogIn CDS(A0); 00026 AnalogIn Sensor0(A1); 00027 AnalogIn Sensor1(A2); 00028 AnalogIn Sensor2(A3); 00029 #include "readsensor.h" 00030 00031 #define DHT_DATA_BIT_COUNT 41 00032 00033 ReadSensor::ReadSensor(PinName pin) { 00034 _pin = pin; 00035 _firsttime=true; 00036 } 00037 00038 ReadSensor::~ReadSensor() { 00039 } 00040 00041 int ReadSensor::readData() { 00042 int retryCount,b; 00043 00044 // eError err = ERROR_NONE; 00045 time_t currentTime = time(NULL); 00046 00047 DigitalInOut temp_io(_pin); 00048 00049 00050 00051 if (retryCount > 125) { 00052 } 00053 retryCount ++; 00054 wait_us(2); 00055 retryCount++; 00056 wait_us(1); 00057 00058 00059 b=0; 00060 00061 return 0; 00062 00063 } 00064 00065 00066 // 00067 // 00068 // 00069 int ReadSensor::readPower() 00070 { 00071 int i = 0; 00072 return i; 00073 } 00074
Generated on Wed Jul 20 2022 07:39:25 by
1.7.2