![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Dust Sesnsor PMS5003
Dependencies: DustSenzor NetServices ThingSpeakEthernet mbed
Fork of PMS5003 by
main.cpp@0:2419d81ee03d, 2010-11-09 (annotated)
- Committer:
- segundo
- Date:
- Tue Nov 09 21:28:45 2010 +0000
- Revision:
- 0:2419d81ee03d
- Child:
- 1:57f922fe8fb5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
segundo | 0:2419d81ee03d | 1 | #include "mbed.h" |
segundo | 0:2419d81ee03d | 2 | #include "EthernetNetIf.h" |
segundo | 0:2419d81ee03d | 3 | #include "HTTPClient.h" |
segundo | 0:2419d81ee03d | 4 | |
segundo | 0:2419d81ee03d | 5 | EthernetNetIf eth("mbedSE"); |
segundo | 0:2419d81ee03d | 6 | HTTPClient http; |
segundo | 0:2419d81ee03d | 7 | |
segundo | 0:2419d81ee03d | 8 | int main() { |
segundo | 0:2419d81ee03d | 9 | |
segundo | 0:2419d81ee03d | 10 | printf("Setting up...\n"); |
segundo | 0:2419d81ee03d | 11 | EthernetErr ethErr = eth.setup(); |
segundo | 0:2419d81ee03d | 12 | if (ethErr) { |
segundo | 0:2419d81ee03d | 13 | printf("Error %d in setup\n", ethErr); |
segundo | 0:2419d81ee03d | 14 | return -1; |
segundo | 0:2419d81ee03d | 15 | } |
segundo | 0:2419d81ee03d | 16 | |
segundo | 0:2419d81ee03d | 17 | printf("Connected ok, IP : %d.%d.%d.%d\n", eth.getIp()[0], eth.getIp()[1], eth.getIp()[2], eth.getIp()[3]); |
segundo | 0:2419d81ee03d | 18 | |
segundo | 0:2419d81ee03d | 19 | HTTPText txt; |
segundo | 0:2419d81ee03d | 20 | HTTPResult r = http.get("http://mbed.org/media/uploads/donatien/hello.txt", &txt); |
segundo | 0:2419d81ee03d | 21 | if (r==HTTP_OK) { |
segundo | 0:2419d81ee03d | 22 | printf("Result ok : %s\n", txt.gets()); |
segundo | 0:2419d81ee03d | 23 | } else { |
segundo | 0:2419d81ee03d | 24 | printf("Error %d\n", r); |
segundo | 0:2419d81ee03d | 25 | } |
segundo | 0:2419d81ee03d | 26 | |
segundo | 0:2419d81ee03d | 27 | return 0; |
segundo | 0:2419d81ee03d | 28 | } |