Using DHT11 sensor, sdWrite, wdt. Need to sleep more then this.
Dependencies: DHT GPRSInterface HTTPClient_GPRS SDFileSystem USBDevice mbed
TCP_YEELINK/tcp_yeelink_dfs.h@0:b6b64c1e74bb, 2015-04-01 (annotated)
- Committer:
- seedteam20
- Date:
- Wed Apr 01 16:16:13 2015 +0000
- Revision:
- 0:b6b64c1e74bb
Using DHT11 sensor and wdt. Not fully going to sleep.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
seedteam20 | 0:b6b64c1e74bb | 1 | /* |
seedteam20 | 0:b6b64c1e74bb | 2 | IOT_MbedDfs.h |
seedteam20 | 0:b6b64c1e74bb | 3 | 2013 Copyright (c) Seeed Technology Inc. All right reserved. |
seedteam20 | 0:b6b64c1e74bb | 4 | |
seedteam20 | 0:b6b64c1e74bb | 5 | Author:Loovee |
seedteam20 | 0:b6b64c1e74bb | 6 | 2013-7-21 |
seedteam20 | 0:b6b64c1e74bb | 7 | |
seedteam20 | 0:b6b64c1e74bb | 8 | This library is free software; you can redistribute it and/or |
seedteam20 | 0:b6b64c1e74bb | 9 | modify it under the terms of the GNU Lesser General Public |
seedteam20 | 0:b6b64c1e74bb | 10 | License as published by the Free Software Foundation; either |
seedteam20 | 0:b6b64c1e74bb | 11 | version 2.1 of the License, or (at your option) any later version. |
seedteam20 | 0:b6b64c1e74bb | 12 | |
seedteam20 | 0:b6b64c1e74bb | 13 | This library is distributed in the hope that it will be useful, |
seedteam20 | 0:b6b64c1e74bb | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
seedteam20 | 0:b6b64c1e74bb | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
seedteam20 | 0:b6b64c1e74bb | 16 | Lesser General Public License for more details. |
seedteam20 | 0:b6b64c1e74bb | 17 | |
seedteam20 | 0:b6b64c1e74bb | 18 | You should have received a copy of the GNU Lesser General Public |
seedteam20 | 0:b6b64c1e74bb | 19 | License along with this library; if not, write to the Free Software |
seedteam20 | 0:b6b64c1e74bb | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
seedteam20 | 0:b6b64c1e74bb | 21 | */ |
seedteam20 | 0:b6b64c1e74bb | 22 | |
seedteam20 | 0:b6b64c1e74bb | 23 | #ifndef __TCP_YEELINK_DFS_H__ |
seedteam20 | 0:b6b64c1e74bb | 24 | #define __TCP_YEELINK_DFS_H__ |
seedteam20 | 0:b6b64c1e74bb | 25 | |
seedteam20 | 0:b6b64c1e74bb | 26 | #define HTTP_DEFAULT_PORT 80 |
seedteam20 | 0:b6b64c1e74bb | 27 | |
seedteam20 | 0:b6b64c1e74bb | 28 | #define HTTP_MAX_HOST_LEN 20 |
seedteam20 | 0:b6b64c1e74bb | 29 | #define HTTP_MAX_PATH_LEN 64 |
seedteam20 | 0:b6b64c1e74bb | 30 | #define HTTP_MAX_BUF_LEN 100 |
seedteam20 | 0:b6b64c1e74bb | 31 | |
seedteam20 | 0:b6b64c1e74bb | 32 | // some useful AT command |
seedteam20 | 0:b6b64c1e74bb | 33 | #define STRCSQ "AT+CSQ" |
seedteam20 | 0:b6b64c1e74bb | 34 | #define STROPENGPRS "AT+CGATT=1" |
seedteam20 | 0:b6b64c1e74bb | 35 | #define STRSETGPRS "AT+CGDCONT=1,\"IP\",\"CMNET\"" |
seedteam20 | 0:b6b64c1e74bb | 36 | #define STRSETAPN "AT+CSTT=\"CMNET\",\"\",\"\"" |
seedteam20 | 0:b6b64c1e74bb | 37 | #define STRSETMODE "AT+CIPMODE=0" |
seedteam20 | 0:b6b64c1e74bb | 38 | #define STRSTARTTCP "AT+CIPSTART=\"TCP\",\"42.96.164.52\",\"80\"" |
seedteam20 | 0:b6b64c1e74bb | 39 | #define STRCLOSE "AT+CIPCLOSE" |
seedteam20 | 0:b6b64c1e74bb | 40 | #define STRECHOFF "ATE0" |
seedteam20 | 0:b6b64c1e74bb | 41 | #define STRSLEEP "AT+ESLP=1" |
seedteam20 | 0:b6b64c1e74bb | 42 | #define STRWAKE "AT+ESLP=0" |
seedteam20 | 0:b6b64c1e74bb | 43 | |
seedteam20 | 0:b6b64c1e74bb | 44 | // err code |
seedteam20 | 0:b6b64c1e74bb | 45 | #define ERRTOUT 0 |
seedteam20 | 0:b6b64c1e74bb | 46 | #define OK 1 |
seedteam20 | 0:b6b64c1e74bb | 47 | |
seedteam20 | 0:b6b64c1e74bb | 48 | |
seedteam20 | 0:b6b64c1e74bb | 49 | // post data |
seedteam20 | 0:b6b64c1e74bb | 50 | #define POST1 "POST /v1.0/device/3091/sensor/4346/datapoints HTTP/1.1" |
seedteam20 | 0:b6b64c1e74bb | 51 | #define POST2 "Host: api.yeelink.net" |
seedteam20 | 0:b6b64c1e74bb | 52 | #define POST3 "Connection: close" |
seedteam20 | 0:b6b64c1e74bb | 53 | #define POST4 "Content-Length: 15" |
seedteam20 | 0:b6b64c1e74bb | 54 | #define POST5 "Content-Type: text/plain" |
seedteam20 | 0:b6b64c1e74bb | 55 | #define POST6 "U-ApiKey: 9270322fd7c7683cb9ad198f3464cf0d" |
seedteam20 | 0:b6b64c1e74bb | 56 | |
seedteam20 | 0:b6b64c1e74bb | 57 | #define POST7 "{\"value\": 100}" |
seedteam20 | 0:b6b64c1e74bb | 58 | |
seedteam20 | 0:b6b64c1e74bb | 59 | #define CONTENT_TYPE " application/x-www-form-urlencoded" |
seedteam20 | 0:b6b64c1e74bb | 60 | |
seedteam20 | 0:b6b64c1e74bb | 61 | |
seedteam20 | 0:b6b64c1e74bb | 62 | |
seedteam20 | 0:b6b64c1e74bb | 63 | #endif |
seedteam20 | 0:b6b64c1e74bb | 64 | |
seedteam20 | 0:b6b64c1e74bb | 65 | /********************************************************************************************************* |
seedteam20 | 0:b6b64c1e74bb | 66 | END FILE |
seedteam20 | 0:b6b64c1e74bb | 67 | *********************************************************************************************************/ |