Ashwin Athani
/
mX_Ethernet
mX mbed BaseBoard Ethernet
main.cpp@0:072dedec0039, 2010-12-08 (annotated)
- Committer:
- ashwin_athani
- Date:
- Wed Dec 08 06:22:56 2010 +0000
- Revision:
- 0:072dedec0039
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ashwin_athani | 0:072dedec0039 | 1 | #include "mbed.h" |
ashwin_athani | 0:072dedec0039 | 2 | #include "HTTPClient.h" |
ashwin_athani | 0:072dedec0039 | 3 | |
ashwin_athani | 0:072dedec0039 | 4 | DigitalOut led(LED1); |
ashwin_athani | 0:072dedec0039 | 5 | HTTPClient http; |
ashwin_athani | 0:072dedec0039 | 6 | |
ashwin_athani | 0:072dedec0039 | 7 | /* |
ashwin_athani | 0:072dedec0039 | 8 | execute a php script that returns the time |
ashwin_athani | 0:072dedec0039 | 9 | |
ashwin_athani | 0:072dedec0039 | 10 | <?php |
ashwin_athani | 0:072dedec0039 | 11 | print strftime('%c'); |
ashwin_athani | 0:072dedec0039 | 12 | ?> |
ashwin_athani | 0:072dedec0039 | 13 | |
ashwin_athani | 0:072dedec0039 | 14 | */ |
ashwin_athani | 0:072dedec0039 | 15 | |
ashwin_athani | 0:072dedec0039 | 16 | |
ashwin_athani | 0:072dedec0039 | 17 | int main(void) { |
ashwin_athani | 0:072dedec0039 | 18 | |
ashwin_athani | 0:072dedec0039 | 19 | char result[64]; |
ashwin_athani | 0:072dedec0039 | 20 | |
ashwin_athani | 0:072dedec0039 | 21 | const char url[] = "http://mbed5.dh.bytemark.co.uk/~chris/time.php"; |
ashwin_athani | 0:072dedec0039 | 22 | // printf ("Fetching from : %s\n",url); |
ashwin_athani | 0:072dedec0039 | 23 | |
ashwin_athani | 0:072dedec0039 | 24 | http.get(url, result); |
ashwin_athani | 0:072dedec0039 | 25 | |
ashwin_athani | 0:072dedec0039 | 26 | // Display the page content: |
ashwin_athani | 0:072dedec0039 | 27 | //printf("Result is: %s\n", result); |
ashwin_athani | 0:072dedec0039 | 28 | |
ashwin_athani | 0:072dedec0039 | 29 | // Work is done! |
ashwin_athani | 0:072dedec0039 | 30 | while(1) { |
ashwin_athani | 0:072dedec0039 | 31 | led = !led; |
ashwin_athani | 0:072dedec0039 | 32 | wait(0.2); |
ashwin_athani | 0:072dedec0039 | 33 | } |
ashwin_athani | 0:072dedec0039 | 34 | } |